About supporting iPhone 5 when using nib files and backwards compatibility

送分小仙女□ 提交于 2020-01-03 06:33:12

问题


I've been looking for Apple's documentation and posts regarding this issue, but I didn't make it clear how should I deal with this, since most of information I found is about storyboards and autolayout feature. I'm using nib files instead of storyboards, and in addition I need to support iOS 5+, so I can't use autolayout. I'm using Xcode 4.6.3 and I've observed that, in IB, going to the view's Attributes inspector > Simulated Metrics, you can choose its size ("Retina 3.5 Full Screen", "Retina 4 Full Screen"...). Right now, I have this parameter set to "None", should I have one nib file per each screen size and detect programmatically if current device is iPhone 5 or another phone (similarly to what I do for supporting iPad in Universal app)? If not, how should I manage this iPhone 5 support, given my particular conditions?

Thanks!


回答1:


1.Add "Default-568h@2x.png" image,with this,when app launch will use iPhone5 screen size,if not, when app launch will use iPhone4S screen size

2.Set your Custom ViewController's view autoresizingMask property

eg: self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

3.If your Custom ViewController's subviews include UITableView or UIScrollView, set this subview's autoresizingMask property

eg:self.aScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

That's all you need do.



来源:https://stackoverflow.com/questions/17824358/about-supporting-iphone-5-when-using-nib-files-and-backwards-compatibility

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