Is there any way I can design my classes for both iPhone4 and iPhone5 using the same xib?
相关问题
- Load a nib file to act as a custom keyboard when a
- UINavigationBar change title text color and font s
- How to load xib file with attached view controller
- Best way to change XIB files based on rotation? [c
- Added, then deleted a ~ipad.xib. Now NSInternalInc
相关文章
- Transitioning from XIB files to Storyboard
- Handling the larger device size of iPhone 5 [dupli
- Build xib Interface Builder and load them as subvi
- Initialize a view with a xib
- Unable to load two nib (.XIB) for Single ViewContr
- Load XIB into ViewController Xamarin?
- Hide tab bar item and aligning other tab items
- Autoresize not working in xib
Add a image named Default-568h@2x.png. That will identify your app as one that supports iPhone 5 metrics. And also you need to do auto sizing of your views properly.
Well short answer to you question is YES;
Long is :- If you user XCode 4.5 and build app that is universal the NIB files and Classes would work perfectly for Iphone 4 and Iphone 5; Understand for you it important to know the version of SDK of these mobiles not the mobile version them self.
Another thing is that iphone 5 size is little bigger then iphone 4 so you need to design accordingly.. please read my answer at Iphone 5 screen resolution issue for better understanding.
Also look at the How to develop or migrate apps for iPhone 5 screen resolution? answer for more clarification on universal app desing.
Yes, you can use the same XIB to design for iPhone 4 and iPhone 5 by using Auto-Layout.
Build an app using iOS 6 as the Base SDK and use the Auto Layout feature to make screens that can scale for all type of screens. You'll need Xcode 4.5 to do this.
Get started with Auto Layout here:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2
Please define below line and check condition based on device.
If you want to make some small changes(e.g images position and sizes, scroll view content insets..), you can use codes to differentiate between iPhone 5 and iPhone 4/4s, and implement your codes inside the if/else statement.
Use this:
https://stackoverflow.com/a/12447113/1371949
to detect the iPhone type.
Use
AutoAutoresizing
so that u can make app compatible with both iOS 5 and iOS 6. This is easy if your layout is having minimum dependancies. And this is possible for fixing issues with components likeUIToolBar
. Buttons in iPhone 5.