iPhone - iPhone5 support to existing app?

巧了我就是萌 提交于 2019-12-13 04:50:57

问题


Should i have to place a separate xib Like 1 for iPhone5 and 1 for iPhone4 and lesser Doing this way seems very bad practice. Can any one have idea about it? Also iPhone5 Using Autolayout? i am not getting how Autolayout works.


回答1:


Watch the WWDC 2012 Videos on the subject. There are three 1 hour videos that taught me all I needed to know in order to migrate my apps to Auto-Layout.

https://developer.apple.com/videos/wwdc/2012/




回答2:


If your main issue is the new screen size make sure to add Default-568h@2x.png. This 640 × 1136 image is needed for your app to utilize the iPhone 5's full screen.

Also use

[[UIScreen mainScreen] applicationFrame]

to get the current screen's width and height. Do not hard code 320 width 480 height.

CGRect aFrame = [[UIScreen mainScreen] applicationFrame]; width=aFrame.size.width; height=aFrame.size.height;




回答3:


seperate xib files: yes, is one of the possible ways.

autolayout: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2

(google first hit).




回答4:


I modified my apps to include autolayout. In all honesty, if I'd have been more proactive I would have designed them with new screen sizes in mind at the start - a mistake I won't make again!

How you approach it really depends on how you designed your original application.




回答5:


I found and will help others also: https://github.com/mindsnacks/UIImage-MSImageNamed568hSupport

using this we can load 568h size image for iPhone5 if present o.w. load normal image great help...

Example:

#import "UIImage+MSImageNamed568hSupport.h"
.
.
IBimgViewBG.image=[UIImage ms_imageNamed568hSupport:[NSString stringWithFormat:@"sample.png"]];
.
.

Note: include this images in your project

sample.png      // for earlier versions
sample-568h.png // for iphone5 


来源:https://stackoverflow.com/questions/13006728/iphone-iphone5-support-to-existing-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!