I have tried many different methods, if anyone can give me a method that worked for you please help me.
问题:
回答1:
Don't create a separate Xib for iPhone 5. Instead, add a splash image named Default-568h@2x.png
. That will identify your app as one that supports iPhone 5 metrics.
When the app is loaded - either on an iPhone 5 device - or on the sim with Retina 4-inch display, you will see your app running in full 568 pixel height mode.
You may see some empty spaces, or buttons in the wrong place, and so on. That's because you have not configured the autosizing properties correctly in Interface Builder. Be sure to do that, using the controls below to specify the "sticky-ness" of the the controls, and how they should expand into the additional space.
回答2:
There are a privies question u should do a good search before u ask ;)
here some good answer i'm sure it will help u :
Link
Link 2
if i understand correctly what u wanna this will be 100% helpful , otherwise write more explain.
回答3:
Here you can apply my logic.
you may create the separate XIB for separate device as iPhone(normal),4inches and iPad device.No need to resize XIB to any device specific.just create separate XIB
- (void)createSeperateXIB
{
YourViewController* yourVC
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
if([UIScreen mainScreen].bounds.size.height == 568)//for 4inches device
{
yourVC = [[YourViewController alloc] initWithNibName:@"YourViewController_iPhone5" bundle:nil];
}
else{//normal iphone/iPod device
yourVC = [[YourViewController alloc] initWithNibName:@"YourViewController_iPhone" bundle:nil];
}
}
else{//for ipad
yourVC = [[YourViewController alloc] initWithNibName:@"YourViewController_iPad" bundle:nil];
}
}