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?
Related
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];
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
I have an image named abc.png of size 320 by 156 which runs well on iPhone 4 and an image named as abc#2x.png of size 640 by 312 which also works fine. but when Please enlighten me on how to use the image for the iPhone 6 device?
First of all there is nothing like iPhone6 as of now, it is either iOS6 or iPhone 5.
But I guess you are talking about iPhone 5 with screen resolution 640X1136.
There is no in-built way to select image for iPhone 5.
if you have abc.png and abc#2x.png in resources , and you use a code like:
UIImage * image = [UIImage imageNamed:#"abc.png"];
it will pick abc.png for non-retina display and abc#2x.png for retina display(that includes iPhone 4S and iPhone 5).
If you want to load separate image for iPhone 5, you will need to check the screen height:
if(screenHeight == 480)
{
//iphone 3,3G,4
}
else if(screenHeight == 960)
{
//iphone 4S
}
else if(screenHeight == 1136)
{
//iphone 5
}
This way you may load different images for different iphones.
Please uprate and check the answer if it answers ur question.
The answer to your question, I'm afraid to say, is something called AutoLayout. That's the solution Apple came up with to deal with the different form factor for iOS 6 views. Only #2x images are available, but with AutoLayout, you can tell it exactly how to behave.
Here's a nice tutorial on how to use AutoLayout, I tried it and it works well:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2
what is the Image Naming Convention for iPhone 5 like #2x for retina screens.
It is just the same. The #2x just means it's a retina image.
The only difference is the 568#2x (or whatever it is) for the splash screen but Xcode renames that file for you anyway.
Just keep using #2x.png
till now they have not released any official documentation for the iPhone5 Images.
You can do like this.
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [[UIScreen mainScreen] bounds].size.height * [UIScreen mainScreen].scale >= 1136)
{
//Write the code here for iPhone5 Image.
}
else
{
//this is for unto 4th gen iPhone
}
There is no specific naming convention for images on iPhone 5.
The Default-568h#2x will be shown on launch of an iPhone 5 or iPod Touch 5G. This will also enable the non-letterbox mode of your app. For your other f.e. background images you have to design flexible if you want to cover both screen resolutions. When you building an iPhone 4s App assure that f.e. a background image can be strechted up to the iPhone 5 size.
it is just the same. The #2x just means it's a retina image.
The only difference is the 568#2x (or whatever it is) for the splash
screen but Xcode renames that file for you anyway.
Just keep using #2x.png
I must add, that if you look at the simulator the pictures maybe stretched! You could fix this by checking the box (if u use storyboard) "auto layout" I have some problems too maybe this is a bug which will be fixed I hope...
and on storyboard or .xib u can change the size of the controller like here:
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.