This is my problem: I need instructions on how to fix the 3.5 inch xib for the 4 inch screen. I have already loaded the Default-568 img so I no longer have the letterbox layout.
I have the traditoinal 3.5 inch scren XIB and everything is perfect.
But when we turn to the 4 inch screen there is a large space to be filled and if I rearrange the XIB file for the iphone 5 screen when I turn to the 3.5 screen I can't see the button. Does it makes sense? Also I want to support versions prior to ios 6.
What I need is a fix or code or anything for the IPhone larger screen to be distributed proportionally.I have been reading that a solution could be duplicating the original xib file and arrange myself duplicated file in a 4 inch layout but I could´t figure out how to let the IPhone make the decision of opening one of the two xib files existing.
I have been given this piece of code but I still do not know where to paste it. I tried in the viewDidLoad but nothing;
if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
NSLog(@"Ipad ");
}
else
{
NSLog(@"Iphone %f ",[[UIScreen mainScreen] bounds].size.height);
if ([[UIScreen mainScreen] bounds].size.height == 568) {
//this is iphone 5 xib
viewName=[[NSString alloc]initWithString:@"ViewControllerIphone5"];
} else {
// this is iphone 4 xib
viewName=[[NSString alloc]initWithString:@"ViewController"];
}
}
I don´t know where to put that code; I know it is in the implementation file but I don't know where.I don't want autoresizing masks
Please, I´ll be glad if you could help me with this problem. I need careful instructions as I don´t have a lot of knowledge in the topic.
Thanks in advance!
You have 4 options
1-) using a seperate xib file for 4'' screen, and in applicationDidFinishLaunching:withOptions method deciding which xib to load depending on mainScreen height.
2-) using auto layout ( only ios 6 + )
3-) using struts and springs
4-) calling a method only on 4'' devices, and setting view's frames and positions for 4'' display manually in that method