简体   繁体   English

全屏图像大小和xcode命名

[英]full screen image sizes and naming in xcode

I'm a bit confused here. 我在这里有点困惑。 If, say, I want to set an image as background (full screen) for my ios app (iphone), what are the sizes for the image I have to make? 如果,比方说,我想为我的ios应用程序(iphone)设置图像为背景(全屏),我必须制作的图像尺寸是多少? I googled and found no clear answer yet. 我用谷歌搜索,但没有找到明确的答案。

Using image assets gives no explanation either. 使用图像资产也没有解释。 I tried creating new image set, it just shows 3 slots for 1x, 2x, and 3x. 我尝试创建新的图像集,它只显示3个1x,2x和3x的插槽。 How the xcode differentiate between what image to use for iphone 5 and iphone 6 (different ratio)? xcode如何区分用于iphone 5和iphone 6的图像(不同比例)?

EDIT 编辑

I seem to be unclear about my question. 我似乎不清楚我的问题。 If the image for iphone 5 and 6 is the same, doesn't the aspect ratio differ? 如果iphone 5和6的图像相同,宽高比是否不同? It will be stretched on one device or vice versa on the other and I don't want that. 它会在一台设备上拉伸,反之亦然,我不希望如此。 Back before the iphone 6, I just create image .png, @2x.png, and -568h@2x.png with the size 320x480, 640x960, and 640×1136. 回到iphone 6之前,我只需创建尺寸为320x480,640x960和640×1136的图像.png,@ 2x.png和-568h@2x.png。 So my question is, for iphone 6 and 6+, what is the naming and size for my images? 所以我的问题是,对于iphone 6和6+,我的图像的命名和大小是多少?

If, say, I want to set an image as background (full screen) for my ios app (iphone), what are the sizes for the image I have to make? 如果,比方说,我想为我的ios应用程序(iphone)设置图像为背景(全屏),我必须制作的图像尺寸是多少?

You can use [UIScreen mainScreen].bounds 's width & height to setup your view frame. 您可以使用[UIScreen mainScreen].bounds的宽度和高度来设置视图框。

it just shows 3 slots for 1x, 2x, and 3x 它只显示3个1x,2x和3x的插槽

They're not used for handling ratio of displaying, just for display solution (retina or not). 它们不用于处理显示比例,仅用于显示解决方案(视网膜或非视网膜)。 You can just use xxx.png in your code, and it'll choose to use xxx@2x.png or xxx@3x.png appropriately. 你可以在你的代码中使用xxx.png ,它会选择适当地使用xxx@2x.pngxxx@3x.png

How the xcode differentiate between what image to use for iphone 5 and iphone 6 (different ratio)? xcode如何区分用于iphone 5和iphone 6的图像(不同比例)?

UIImageView has an instance method called -setContentMode: , you can use UIViewContentModeScaleAspectFill mode for displaying in different devices w/ different ratio, ie, some parts will be cut off. UIImageView有一个名为-setContentMode:的实例方法-setContentMode:你可以使用UIViewContentModeScaleAspectFill模式在不同的设备中显示不同的比例,即一些部分会被切断。

This link should give you an overview of the differences between the 1x, 2x and the 3x image assets which we get once we create a new image asset. 此链接应该概述我们创建新图像资产后获得的1x,2x和3x图像资产之间的差异。

http://9to5mac.com/2014/08/29/support-for-3x-image-assets-found-in-latest-ios-8-beta-ahead-of-larger-display-iphone-6/ http://9to5mac.com/2014/08/29/support-for-3x-image-assets-found-in-latest-ios-8-beta-ahead-of-larger-display-iphone-6/

Also when you create a new image asset, you can select image for specific devices such as (iPhone and iPad), if you are only developing for certain devices. 此外,当您创建新的图像资源时,如果您仅针对某些设备进行开发,则可以为特定设备(如iPhone和iPad)选择图像。

Select the devices as "Device Specific" from the Image Set Shown on the right side of the image. 从图像右侧的图像集中选择设备作为“特定于设备”。

As for you question, iPhone 5 and iPhone 6, xcode will take the same image assets ie 2x, for iPhone 6 Plus it takes the 3x image. 至于你的问题,iPhone 5和iPhone 6,xcode将采用相同的图像资产,即2倍,对于iPhone 6 Plus,它需要3倍的图像。

在此输入图像描述

App Icon and Launch Image 应用程序图标和启动图像

Now for the App icon and the Launch image, this following link will guide you through. 现在,对于App图标和Launch图像,以下链接将指导您完成。

http://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-managing-images-xcode-5-asset-catalogs http://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-managing-images-xcode-5-asset-catalogs

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

for the launch image there are different options available, such as you can individually set images for the landscape and portrait images for different devices. 对于启动图像,有不同的选项可用,例如您可以为不同设备单独设置横向和纵向图像的图像。

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

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