简体   繁体   English

iPhone / iPhone Retina / iPad / iPad Retina的单独的故事板

[英]Separate storyboards for iPhone/iPhone Retina/iPad/iPad Retina

I have a question that may sound odd, but being somewhat of a newbie, I am guessing no question is a stupid question... 我有一个听上去很奇怪的问题,但是作为一个新手,我猜没有一个问题是一个愚蠢的问题...

Do I need separate storyboards for all four devices? 所有四种设备都需要单独的故事板吗?

Right now I have two storyboards, one for iPhone and one for iPad, but what I get my view frame it always shows the size of the device, not the retina device. 现在,我有两个情节提要板,一个用于iPhone,一个用于iPad,但是从我的视野来看,它总是显示设备的尺寸,而不是视网膜设备的尺寸。 So for example on the iPhone my view size is 320x460, and for iPhone Retina it shows the same... likewise for iPad. 因此,例如在iPhone上,我的视图尺寸为320x460,而对于iPhone Retina来说,它的显示尺寸却相同……对于iPad也是如此。

Thanks 谢谢

No, you don't. 不,你没有。 Yes it's the same resolution for the developer point of view. 是的,对于开发人员而言,分辨率是相同的。 iOS will make all the adjustment. iOS将进行所有调整。 The only important issue is that if you use images in your app bundle (like tab icons) you have to add one for not retine a one for retina (with double resolution). 唯一重要的问题是,如果您在应用程序包中使用图像(如标签图标),则必须添加一个图像而不是视网膜图像(具有双分辨率)。 For example if you have icon.png of 24x24px, you have to add icon@2x.png of 48x48px. 例如,如果您有24x24px的icon.png,则必须添加48x48px的icon@2x.png。 iOS automatically will replace your icon for the "@2x" filename in retina divices. iOS会自动将您的图标替换为视网膜设备中的“ @ 2x”文件名。

You can differentiate the graphic content of your application, but the views / storyboard for the moment I do not think you can. 您可以区分应用程序的图形内容,但是暂时认为视图/情节提要无法实现。

If you want to take advantage of the resolution of retina screens you can use the @2x trick. 如果要利用视网膜屏幕的分辨率,可以使用@ 2x技巧。

This consists of the following, we give the example of the application icon_ 这由以下内容组成,我们以应用程序icon_为例

  • Icon.png ( default icon for the iphone at 57x57 pixels ) Icon.png(iPhone的默认图标,分辨率为57x57像素)
  • Icon@2x.png ( default icon for the iphone with retina display at 114x114 pixels ) Icon@2x.png(带有114x114像素视网膜显示屏的iPhone的默认图标)

  • Icon~iPad.png ( default icon for the ipad at 72x72 pixels ) Icon〜iPad.png(ipad的默认图标为72x72像素)

  • Icon~iPad@2x.png ( default icon for the ipad with retina display at 144x144 pixels ) Icon~iPad@2x.png(带有144x144像素视网膜显示屏的ipad的默认图标)

This trick is useful for all your graphic content and no requires extra code when you make your interfaces and your code. 此技巧对所有图形内容都很有用,并且在创建界面和代码时不需要额外的代码。 When you have to specify the graphics file to be used, always specify the file which does not have the "@2x". 当您必须指定要使用的图形文件时,请始终指定没有“ @ 2x”的文件。

I hope that is helpful. 希望对您有所帮助。

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

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