简体   繁体   English

我需要iPhone / iPad专用的按钮图像吗?

[英]Do I need iPhone/iPad specific button images in my case?

Here is my situation: I have a simple app with some buttons that are images. 这是我的情况:我有一个简单的应用程序,其中有一些按钮是图像。 I have the image set in xcode using the menu on the right (i simply click the button and pick the image I want from the dropdown). 我使用右侧菜单在xcode中设置了图像(我只需单击按钮,然后从下拉列表中选择想要的图像)。 I created them using a simple image program so they look somewhat glossy and nice, but nothing crazy. 我使用一个简单的图像程序创建了它们,因此它们看起来有些光泽和不错,但没有什么疯狂的。 I also sized them for an iphone screen. 我还为iPhone屏幕调整了尺寸。

Using some auto layout, I've been able to ensure the layout stays the same and the buttons change size with the size of the iphone. 通过使用一些自动布局,我已经能够确保布局保持不变,并且按钮会随着iphone的大小而改变大小。 I would like this to be the case with the iPad as well, but I'm worried if they size too big, I'll lose image quality with the button images. 我也希望iPad也如此,但是我担心它们的尺寸太大,按钮图像会降低图像质量。 I'm very new to layout and coding and have only been doing this development stuff for a little while. 我对布局和编码非常陌生,仅做了一段时间的开发工作。 What are my options? 我有什么选择? I figure they are...(and these might not even be possible, throwing them out there): 我认为它们是...(而且可能甚至无法将它们扔到那里):

1) Create two version of the app, one only for iPad and one only for iPhone with different size/quality images for each. 1)创建两个版本的应用程序,一个版本仅适用于iPad,一个版本仅适用于iPhone,每个版本均具有不同的尺寸/质量图像。

2) Code swift to identify the device and assign the different image accordingly 2)快速编码以识别设备并相应地分配其他图像

3) Pick a resolution for the iphone image that when expanded on iPad won't lose much quality 3)为iPhone图像选择分辨率,使其在iPad上扩展时不会损失太多质量

4) I'm overreacting and this isn't a big deal whatsoever since it's just a basic glossy button with some shadowing. 4)我反应过度,这没什么大不了的,因为它只是带有一些阴影的基本光泽按钮。

Thank you! 谢谢! Advice/links appreciated. 建议/链接表示赞赏。

The better option to add images for both iPhone(retina/non-retina) and iPad(retina/non-retina). 为iPhone(视网膜/非视网膜)和iPad(视网膜/非视网膜)添加图像的更好选择。 Put the high-resolution and original versions of your image in the same location in your application bundle. 将图像的高分辨率版本和原始版本放在应用程序捆绑包中的同一位置。

Ones you added images same as the below naming format in to your application resources, the application will automatically pick the right one for you. 您在应用程序资源中添加了与以下命名格式相同的图像的应用程序,该应用程序将自动为您选择合适的图像。

MyImage.png - Default version of an image resource. MyImage.png图像资源的默认版本。

MyImage@2x.png - High-resolution version of an image resource for devices with Retina displays. MyImage@2x.png具有Retina显示器的设备的高分辨率图像资源。

MyImage~iphone.png - Version of an image for iPhone and iPod touch. MyImage~iphone.png -iPhone和iPod touch的图像版本。

MyImage@2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays. MyImage@2x~iphone.png具有Retina显示屏的iPhone和iPod touch设备的图像的高分辨率版本。

MyImage~ipad.png - Version of an image for iPad. MyImage~ipad.png -iPad图像的版本。

MyImage@2x~ipad.png - High-resolution version of an image for iPad devices with Retina displays. MyImage@2x~ipad.png带有Retina显示屏的iPad设备的高分辨率图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM