iOS 导航栏项目图片大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22607674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:48:01  来源:igfitidea点击:

iOS navigation bar item image size

iosnavigationbar

提问by user2053760

I want to customize my NavigationBarbutton and using my own images.

我想自定义我的NavigationBar按钮并使用我自己的图像。

The question is what the size should be?

问题是尺寸应该是多少?

I found that the button size should be 40*40, so the image should be 80*80 for retina?

我发现按钮大小应该是 40*40,所以视网膜的图像应该是 80*80?

回答by Suragch

These are the sizes that the documentationrecommends for custom icons now.

这些是文档现在为自定义图标推荐的尺寸。

enter image description here

在此处输入图片说明

  • @2: 50 x 50
  • @3: 75 x 75
  • @2:50 x 50
  • @3:75 x 75

Create two images of the above pixel sizes and then add them to a new image set in your Assets.xcassets file. (Apparently the @1 size is no longer needed.)

创建两个上述像素大小的图像,然后将它们添加到 Assets.xcassets 文件中的新图像集中。(显然不再需要 @1 大小。)

enter image description here

在此处输入图片说明

Alternatively, you could use a universal vector image (pdf) (see hereand here). This has been my preference recently.

或者,您可以使用通用矢量图像 (pdf)(请参阅此处此处)。这是我最近的偏好。

Related answer

相关回答

回答by Vinoth Vino

Apple updated their Human Interface Guidelines Docs. Now the recommended sizes for creating custom icons for Navigation Barand Toolbar

Apple 更新了他们的人机界面指南文档。现在为导航栏工具栏创建自定义图标的推荐尺寸

  • @2x- 48px × 48px(24pt × 24pt @2x)

  • @3x- 72px × 72px(24pt × 24pt @3x)

  • @2x- 48px × 48px(24pt × 24pt @2x)

  • @3x- 72px × 72px(24pt × 24pt @3x)

enter image description here

在此处输入图片说明

回答by davidrayowens

The typical standard sizes (non-Retina) are 22px by 22px, while the 2x (or Retina) sizes are 44px by 44px.

典型的标准尺寸(非 Retina)为 22px x 22px,而 2x(或 Retina)尺寸为 44px x 44px。

回答by Paul N

Apple docs were updated and now the recommended size is 25pt x 25pt.

Apple 文档已更新,现在推荐的尺寸为 25pt x 25pt。

Please refer to documentation here.

请参阅此处的文档。

回答by Sea Coast of Tibet

Here are the current sizes:

以下是目前的尺寸:

https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/custom-icons/

https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/custom-icons/

"Toolbar and navigation bar - between 24x24 (@1x) and 28x28 (@1x)".

“工具栏和导航栏 - 介于 24x24 (@1x) 和 28x28 (@1x) 之间”。

回答by Disha

You should prepare 3 images icons for each tab bar item (1x, 2x and 3x).

您应该为每个标签栏项目准备 3 个图像图标(1x、2x 和 3x)。

First create the 3x at 75w 75h pixels (maximum: 144 x 96) and save it as [email protected].

首先在 75w 75h 像素处创建 3x(最大:144 x 96)并将其保存为 [email protected]

Then resize it to 50w 50h pixels (maximum: 96 x 64) and save it as [email protected].

然后将其调整为 50w 50h 像素(最大:96 x 64)并将其保存为 [email protected]

Finally resize it to 25w 25h pixels (maximum: 48 x 32) and save it as iconTab0.png.

最后将其调整为 25w 25h 像素(最大:48 x 32)并将其保存为 iconTab0.png。

Now all you need is to select those 3 images at your finder and drag them to your image assets.

现在您只需要在取景器中选择这 3 张图像并将它们拖到您的图像资产中即可。

human interface guidelines

人机界面指南

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明