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

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.

Related

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.

Adjust iPhone 5 Screen Size Without Using Autolayout

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

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..

why does an iOS universal app need to have two different xib files?

I'm a newbie of iOS development and I'm confused regarding universal app.
We can use the same code, same xib file for iPhone 4(retina) and previous iPhones, but why we should write two different xibs for iPhone and iPad? What's the difference?
For iPhone and retina iPhone, we use "point" instead of pixel for the coordinate. Why we can't use the similar method for iPhone and iPad?
For some simple apps, it is possible to design your iPhone UI and reuse the same xib file for the iPad. Just select your Target in XCode and copy the Main Interface text from iPhone / iPod Deployment Info to iPad Deployment Info. If you're using a Main Storyboard, copy that too. However, the iPad does not simply scale everything up from the 320*480 / 640*960 iPhone screen to the 768*1024 / 1536*2048 iPad screen. #elgarva correctly says that this would look terrible. Instead, the iPad version makes use of your autosizing masks to resize or reposition each view.
If all of your views can be considered to be left-middle-right or top-middle-bottom, this may work. If you have anything more complicated, you'll need to design a separate iPad interface.
Duplicating your iPhone UI is not just discouraged for aesthetic reasons - iPhones often end up containing a deep and confusing navigation tree for tasks that the iPad can fit on a single screen.
The main reason, is that if you just scale the elements on the UI to fit the larger screen, it wouldn't look nice... and you don't need to do anything for it to work, it automatically does it for you if your app is iPhone only and installed on an iPad (if the user chooses to).
Having a different XIB lets you rearrange your app, and think it so that you can take advantage of the larger screen. You can probably show more information on one iPad view than on 3 different screens on the iPhone... so, your iPhone app could show basic info and expand it when the user taps on it, while your iPad version could show all the information on load, plus extra graphics that look nice but aren't needed, and wouldn't make sense on the iPhone screen.
PS: If you're starting a new app, I strongly suggest you using the storyboard if your app won't have a lot of views... it's really easy to get started and it lets you see your app flow at a glance.
The ratina display just doubles the resolution of original iPhone. If you don't provide separate graphics for retina display, then system just doubles the resolution of resources.
The points are related to physical size of screen, which is similar in old and new iPhones.
For iPads, the screen size changes. This means that its dimension in points will be different from that of iPhone.
duplicating the xib file and renaming that as filename~ipad.xib is working great for me in ios6.1

iphone app only showing in little window on ipad

I have developped an iPhone app and I now need it to work on iPad. On the simulator the app only show in a little window (the x2 zoom enable the app to work in full screen) but is there a way to have the app directly showing in full screen ?
Thanks a lot,
Luc
go to project settings and set Targeted Device Family to iPhone/iPad
As Max said, go to project setting and set Target Device Family to iPhone/iPad. But this is not enough. With this change the application type will be universal application. This is good, because the app will start in full screen, but if you hard coded the dimensions of the views in the application then the look and feel on the iPad will be bad. So do the first step what Max suggested for you and then check if the app looks like you want, because it will not arrange the views automatically. You should do the changes from code or from nibs.
There is a little help if you set properly the autoresizing masks.
Edit:
Project menu -> Edit Project settings -> Targeted device family
You will need to do at least the following:
Change the Targeted Device Family to include the iPad.
Create or convert all needed .xibs for the iPad (using the Interface Builder Menu).
Reference the top level iPad .xib from your app's info.plist (using the NSMainNibFile~ipad key).
Handle the iPad paradigm wherever the controller or view source code needs to differ.