|Sep 13, 2012, 03:34 AM||#1|
XIB for both iPhone 3.5" and 4"?
I have installed the GM of Xcode 4.5 and there is an option in the .xib and storyboards Attributes Inspector (under 'Simulated Metrics') for choosing between 'Retina 3.5 Full Screen' and 'Retina 4 Full Screen'. If I choose Retina 4, adapt the interface and run it on my 3.5" device, the UI elements are in the positions for the 4" screen. Is there a way to use the same xib for a screen in the app and have it adapt depending on the screen size?
Macbook Air 13", 1.7GHz i5, 4GB RAM, 256GB SSD
White iPhone 5S, 16GB
|Sep 13, 2012, 05:23 AM||#2|
Might be possible you just need to make 2 xibs, and make an Utility class that checks what device you are on, and it will return you the good string to use in the initWithNibname method. That's what I did for iPhone/iPad, instead of checking all the time before the initWithNibName. just do [Nibchecker nibWithName:@"basisXib"]
and this will return the XIB name like basisXib_iPhone5 or basisXib_iPhone4, which you need to create obviously.
iPad Mini, iPad 4, iPad 2, iPhone 3G,4,5, iMac 24", Mac Mini Last gen, Macbook Pro Retina with Dell U2711
|Sep 13, 2012, 06:37 PM||#3|
Failing that you can use the approach the other poster suggested, where at runtime you figure out which device you are running on and load a different XIB file for each. I will try to avoid that, though, because it is a pain to develop and maintain multiple XIB files with the same views and controls and set up all the outlets, actions, and attributes. I already do that for iPhone and iPad versions of my views, and supporting another XIB file for iPhone 5 would make it even worse.
Duncan Champney, WareTo.
Check out our latest iOS app, Face Dancer, available for free on the App Store.
|interface builder, ios, iphone, iphone 5, xcode|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Why "no Service" then "Searching" for factory unlocked, jailbrok iPhone 3GS iOS 4.3.5||heathvc||iPhone Tips, Help and Troubleshooting||29||Jun 10, 2013 04:25 AM|
|Is this battery life for my iPhone 5 considered "good" or "average?"||Mr. RPG||iPhone||25||May 26, 2013 05:45 PM|
|Verizon iPhone 5: repeatedly being told I sound "distant" or "under water"||exi||iPhone||19||May 10, 2013 10:37 AM|
|Does your iPhone 5 "screen distortion" or "ghosting" issues?||Algo922||iPhone||0||Dec 8, 2012 01:27 PM|
|Start a new tab similar to "iOS blog" and "Mac blog" but make it "IPhone Leaks?"||Dewroo||Site and Forum Feedback||2||Aug 23, 2012 09:47 AM|
All times are GMT -5. The time now is 01:15 AM.