也许,您想使用两个故事板,一个用于 iPhone 3.5",另一个用于 iPhone 4"。通过将此代码放在您的应用程序委托上,您将能够使这些故事板工作:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568.0){
//move to your iphone5 storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphoneFiveStoryboard" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}
else{
//move to your iphone4s storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}}
// Override point for customization after application launch.
return YES;
}
现在您只需要转到:文件 -> 新建... -> 文件 -> 用户界面 -> 故事板
并将情节提要命名为“iphoneFiveStoryboard”...
现在您可以用 4" 视图重新制作所有故事板!
希望你能理解,我试图解释我能做的最好的......