This question already has answers here:
How to develop or migrate apps for iPhone 5 screen resolution?
(30 answers)
Closed 9 years ago.
The new iPhone 5 display has a new aspect ratio and a new resolution (1136 x 640 pixels).
What is required to develop new or transition already existing applications to the new screen size? I have already added the splash screen which works for the 4-inch retina display. But still I am getting the 88 pixel gap in the top and bottom of my application screens.
NOTE: I have enabled AutoLayout. But some of the components in my classes are created by XIB and some of them by writing code in the implementation file.
If I enable Auto layout then how should I resize the objects that are been created programatically Please concentrate on the bold lines and provide a solution to me. My UI is very complex and that's why I am not choosing the two XIB's concept for different screen sizes.
If you enable Auto Layout, then for the views that you create in code - you might add NSLayoutConstraints to them (then be sure to set -translatesAutoresizingMaskIntoConstraints to NO).
if ([UIScreen mainScreen].bounds.size.height >= 568)
{
// rotationView.frame = CGRectMake(0, 0, rotationViewWidth, rotationViewHeight+88);
}
add this code to your code under where you want to match the new iPhone5 aspect,then rotationView is need to modify . rotationViewHeight add 88,and y modified similar
Controller : AViewController *aViewContrller = [[AViewController alloc] initWithNibName:(iPhone5?#"AViewController-5":#"AViewController") bundle:nil];
Related
I would like to know how could I make my application enable for iphone 5 standards (especially screen-size).
I currently have an application designed for iPhone 4 so all the views are 460 px height.
Can I do some simple and automamic update to make it for iPhone 5? Without ruining the iPhone 4 style, I would like this app to be avaible on both.
There is not magic code that will make app adjust it self, just the Default-568h#2x.png top tell iOS that you app support the new 4" height.
The most important part is how you have set the Autoresize mask of you views. If then are set to grow (UIViewAutoresizingFlexibleHeight) then they will grow to fill the screen.
Check every view that the alginment of button have the correct Autoresize mask, for example if a button is ment to be at the button of the screen make sure that the Autoresize mask is set to the fix it self to the bottom and nog the default top.
First, see what your app looks like on iPhone 5. This can be done by including a Default-568h#2x.png within your project. This is the launch image for iPhone 5, and indicates to the OS that you support the taller screen size.
If you've programmmed your application well (for example, with decent Autoresize masks), the OS should take care of most of it for you, and it'll look decent already. If you want to use AutoLayout in iOS 6, this will also help for the iPhone 5.
If it does not look that great, then you can do some conditional modifications for iPhone 5 using the macro:
#define IsTallPhone() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)
So for example:
if (IsTallPhone()) {
frame = CGRectMake(0,0,200,500); // Use Tall Frame
}
else {
frame = CGRectMake(0,0,200,300); // Use Normal Frame
}
The conditional can be done for anything, for example to load a different .xib file. It entirely up to you.
Open your project in xcode 4.5 and just add a default image of iPhone5 resolution in launch images. all other screens will be stretched to fill the iPhone 5 screen. go to target summary and add retina 4 inch launch image.
But it really depends on the graphics they may appear stretched go for separate xib if required
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?
I have some applications in IPhone.Now i want them to be compatible to IPhone5.Somewhere i read that i need to change the splash screen to 4 inch.Shall i need to change this in all my xibs,or splash only.Currently i am using xcode4.2.i am getting IPhone5 simulator,is that enough or i need to install any later version to get the correct simulator.Where from i will get the latest simulator of IPhone5. Can anybody help me with the exact steps for acheving this transition?
You definitely need to install XCode 4.5, and to create a new splash image for the 4-inch screen, called Default-568h#2x.png.
You shouldn't change the size of your xibs, because you'll want your app to work on both old and new phones. However, you may want to change the autoresizing masks of some of the views in your xibs so that they stretch to fill the larger screen.
here are the points *if you want to make use of full height of the iPhone5 create splash screen that's exactly 640x1136 pixels in size and name default-568h#2x.png *if you have problem with rotation check a)window.rootViewController = firstViewcontroller (dont add view to your window) b)implement the new rorate delegate function
*Use viewDidLayoutSubviews rather than viewDidLoad to set up widget sizes relative to the window *You can manually check the screen size and load the right image like this:
UIImage* myImage;
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
if ([UIScreen mainScreen].scale == 2.f && screenHeight == 568.0f) {
myImage = [UIImage imageNamed:#"myImage-568h#2x.png"];
} else {
}
myImage = [UIImage imageNamed:#"myImage.png"];
or use catogary from the following GIT gist https://gist.github.com/3719620
if you want to test your app with IOS 6 simulator with 4 inch display you need to install Xcode 4.5 from developer center.
UPDATED:
You can refer to discussion
Will Xcode 4.3.2 suffice to build apps for iOS 6?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?
I'm (still) trying to convert one of my iPhone applications to iPhone 5, but it still looks like this in the simulator...
What am i doing and why won't it fill up the entire screen?
Have you provided a 4" sized launch image? That's the indicator that tells the OS that your application supports the full screen.
Have you selected in your UIView attributes inspector in XCode iPhone 5 screen size?
Please have a look at the url,
iPhone 5 TabBar not functioning in proper position
Now, in xib, at the right side, under 'Interface Builder Document', put a tick-mark on use autolayout and fix your objects in xib accordinlgy.
Download and install Xcode 4.5 GM. Set a 4-inch launch image for
your app. This is how you get 1136px screen height (without it, you
will get 960px with black margins on top and bottom).
Test your app, and hopefully do nothing else, since everything should work magically if you had set auto resizing masks properly. If you didn't, adjust your view layouts with proper auto resizing masks or look into Auto Layout if you only want to support iOS 6 going forward.
Also note: The auto-rotation API has changed completely, take a look at that as well if your application supports any rotation other than default.
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
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?
I have UIViewController with a view that is 320x480. I made autoresizing mask setup for UIView to stretch it horizontally and vertically. But when I run it on iPhone 5 simulator there are black space at top and bottom.
Why UIView is not resized automatically from 480 to 568 pixels (vertically) to fill the empty space ?
You need to add Default-568h#2x.png launch image to your project with 1136x640px resolution.
See here:
How to develop or migrate apps for iPhone 5 screen resolution?