Adjust iPhone 5 Screen Size Without Using Autolayout - iphone

Enabling Autolayout in .xib or .storyboard and adding a splash screen of 640px by 1136px enables iPhone 5 resolution support for the taller screen.
However, doing so, my app started to display some funny things where I assume autolayout is not a great idea.
I am wondering if there is a way to enable iPhone 5 device support, i.e. fix app's resolution without using Autolayout? Maybe I can set in the code?
If yes, then I will have no need to create 2 storyboards or nibs to support iOS5- and iOS6.

If you weren't using Autolayout before, you won't need to use it for iPhone 5 support.
When you're putting your interface together, you just need to check your bindings, and toggle between the taller phone size, and the regular phone size, as described here:
Xcode Storyboard displaying the new iPhone 5 screen size?
If your screens look fine in both screen sizes then you're done.
If you are doing a lot of coding to show your UI, then you'll have more work to do.

I found a great answer a couple weeks ago (link below). You will copy and paste your older iPhone Storyboard, rename it to reflect the iPhone 5, and press the button that expands the screen size, found on the bottom of the layout grid. Some minor coding adjustments might be needed, but this sample code is used in the AppDelegate to detect which device is running, and hence, which Storyboard to use. You'll just have to duplicate your interfaces, but these GUI changes can be made without code and without AutoLayout (also good to note that AutoLayout removes iOS 5--and lower--compatibility)
xcode 4.5 how to pick storyboards at launch

Related

Make a iphone 3 app fit the iphone 5 4-inch screen

I have a Xcode project for a iphone app that has been designed to be universal and has a deployment target of 4.3. The project uses a .xib file for constructing the user interface and I am only familiar with storyboards. My goal is to make the app that only works on the 3.5 screen fit the iphone 5 4-inch screen. Do you guys have any tutorials online or tips on how I can do this? Thanks in advance!
The process is pretty simple:
Make sure you have a Default-568h#2x.png default image. See App Launch (Default) Images in the iOS App Programming Guide for information about these default images, sizes, etc. But by adding this default image, that informs iOS that your app supports the 4" screen.
When designing your NIBs, you can toggle the simulated metrics between 4" and 3.5" to see how the view is rendered for both:
You can then adjust your autosizing masks for your various controls so they resize correctly. This is an example where the margins are all fixed and it should grow as you go to 4" screen:
"All" you have to do is properly set the struts-and-springs "autoresizing masks" in Interface Builder. The same as you'd do for Storyboards.
A friendly tip while at it: don't do storyboards except for the simplest of apps, and don't use auto layout before you're familiar with struts-and-springs and are absolutely sure you can't use struts-and-springs to do your work.
Turn off auto layout in new .xibs here:
Of course, if you have device-specific artwork (such as a background that's exactly 960x640), you'll have to do more work than that, but you're prepared for that piece of the puzzle, right?
Next, add a Default-568h#2x.png file to your project. Make it 1136x640, or if you're not covering the status bar area, make it 1096x640.

iphone 3.5 and 4 issue

i was making an application is ios6 but i have to make it compatible for ios5 too. i made weak link to the libraries and they are working fine but one issue arises and i still not solve it. the problem is regarding iphone 5 and iphone 4 sizes. i had some questions:
in view under xib what i should pick view size iphone 3.5 or iphone 4?
if i place in buttons and other controls according to 4 size than they goes out when i run it on iphone 4 and vice versa?
should i need to make two xibs to overcome it?
or is there any other method which will resize my view and make it compatible for iphone 4 and 5?
EDIT
iam making application on ios6 and i want my application to run on both iphone 4 and 5.
thanks .
Generally you don't have to worry about this because iOS can move your controls around for you using either:
Auto sizing: If supporting iOS versions prior to 6, use the auto sizing masks (sometimes affectionately called "springs and struts", and when accessing programmatically, it's called the autoresizingMask) so that everything moves arounds appropriately. So select the "size inspector" and adjust the "autosizing" masks:
Autolayout: If you're developing an iOS 6 and above app, you can also use the new the "autolayout". See Cocoa Auto Layout Guide which has tons of relevant links. Also see the Xcode 4 Users Guide.
Turn autolayout on and off: If you want to develop an iOS 4/5 compatible app, you may need to turn off "autolayout". If so, go to Interface Builder, click somewhere on the background, select the "file inspector" in the right panel, and examine/change the "Use Autolayout" flag.
I'd suggest designing for the 3.5" screen. And let it resize or move your controls for the 4" screen.

app compatibility with iphone 5 screen size [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to detect iPhone 5 (widescreen devices)?
Do any adjustments need to be made for an app started in development prior to the iphone 5 in order for them to work on the iphone 5's larger screen?
If so, what are these changes, or where can I find what to change? google hasn't been too helpful so far.
Thanks
After adding the Default-568h#2x.png launch image, follow the steps outlined in this post:
How to develop or migrate apps for iPhone 5 screen resolution?
If you are having issues with the images being used INSIDE the app, and you want to support iPhone 5 and pre-iPhone 5 devices, use this:
Dealing with different size images in a xib for iPhone5 versus iPhone4?
You need to add a default launch images with 640x1136px named Default-568h#2x.png to support the iPhone 5 screen.
First, you have to have a 640x1136 launch image (with -568h#2x.png suffix) to make it compatible with the iPhone 5, but to fully make use of the larger screen, there are a many ways to do it. I find the easiest way to do it is to make two separate storyboards, making a new one for the iPhone 5, while maintaining the one you have already used for the iPhone 4S, 4, etc. Using two storyboards removes the necessity for AutoLayout; enabling AutoLayout, it is good to note, also removes iOS 5 compatibility. Use the code in this answer to get started.
Depending on how your app views are laid out, you may not need to make too many changes. If you have views that resize and are anchored correctly, such as scroll views or table views, they will expand to fill the additional space on the iPhone 5 screen. You need to add an additional launch image for the new screen size too.
the iphone 5's screen is taller so you'd need to have images with a resolution of 1136x640 also included in your images folder. (add -568h#2x at the end of image's filenames)
also, everytime you will adjust your sprites and everything else that goes on the screen, you will need to account for the iphone 5 separately, just like you account for the ipad and the iphone (non retina and retina).

Handling the larger device size of iPhone 5 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to deal with iPhone 5 screen size?
Watched the iPhone 5 keynote and yes the device height and a resolution of 640 X 1136. So I saw they showed how existing apps which work on that. But I believe if we use native components like tab bar, navigation bar etc. will work fine. But how about custom tab bars, navigation bars and controls which resides relative to the device orientation. So these are my questions.
1) How to handle custom layouts which has custom tab bars, navigation bars, relative contents etc.
2) Welcome screen. We will need 2 sizes right now. So in iPhone 5 do we need another 2 more for normal and retina?
3) If you carefully watched the keynote seems iPhone 5 will cut some portion of view from left and right so there is no any additional change in the app development. Has anybody noticed that?
1) This depends on how you laid them out, you might need to adjust how you set the frame, change autoresizing masks etc, or if iOS 6 only is an option you could move to auto layout. Without knowing your code I cant give much more detail
2) There is no non-retina iPhone 5 so you only need 1 more Default.png size, named Default-568h#2x.png (btw adding this new sized default image is the trigger for iOS to show your app without letterboxing, so for some apps this is the only change which will need to be made)
3) This is the letterboxing I mentioned, it is what all current apps will do on the iPhone 5 until they are updated with a new default.png
My understanding is that all existing apps will work on iPhone 5 and you will just have the black borders. However you will now have the capability to tailor apps to the bigger screen size. I imagine that there will now be a new sized .xib or storyboard that will match the size of the iPhone 5. You will be able to put an if statement in the app delegate to choose which .xib/storyboard to load based on the screen size. unfortunately now I think we will have to create multiple .xib/storyboard files, similar to how universal apps are made at the moment. The file loaded is selected based on the device.
Hope this helps

How does a UIStoryBoard change on iphone 5

I have an already shipped app on App Store that made use of Storyboard.
I see from the keynote, comparing to previous model that iPhone 5 has a taller screen.
I wonder how this will impact on my esisting storyboard, because from my 'app point of view' there's only one difference which is the background.png. All the rest is just plain UITableView that can just fit more rows.
I cannot find any document for this on Apple site (I have always been so noob in finding things on Apple developer site).
Has anyone made adjustment to his already developed and published app to match with new layout ?
If yes, do I have to develop a brand new storyboard, or is there an adjustment to be done with code ?
[UPDATE]
I am reporting my experience, now that Xcode 4.5 is long shipped for development.
Xcode itself, as some suggested, asked me if I would like to enable tallest screen support by creating a default png. After saying yes, I had to enter each segue in storyboard for some adjustment, change png background (which was unstrechable by design) with a tallest one, change stretching settings and redeploy.
It has been an annoying work because I have quite some segues, and Xcode doesn't allow to reuse templates within Interface Builder.
Old apps without 1136x640 resolution support will run letterboxed, with black areas on top and bottom.
You can enable new layout support for existing project simply by supplying new Default-568h#2x.png loading screen. Take heed though, you'll have to test your old interface on both old and new resolution (via iOS Simulator) to make sure everything looks good and works as designed.
Its been said when iphone 5 is launched that your app view will be filled with black color on top and bottom if it is not taking account for the increase size ( not designed for iphone5 screen)
so your app will just work fine but will have black border on both and top to filled the extra space..