请教一个关于iphone屏幕尺寸的问题,
我创建了两个xib文件(MainWindow.xib
和MainWindowiPhone5.xib
)。这样我的屏幕就可以支持两种屏幕尺寸。
我试过在AppDelegate.m
中编程,但是没有实现。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
UIStoryboard *storyBoard;
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
if(result.height == 1136){
storyBoard = [UIStoryboard storyboardWithName:@"MainWindowiPhone5" bundle:nil];
UIViewController *tabBarController = [storyBoard instantiateInitialViewController];
[self.window.rootViewController = self.tabBarController];
}
}
return YES;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
// Set the tab bar controller as the window's root view controller and display.
self.window.rootViewController = self.tabBarController;
tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
return YES;
}
如何让两个xib都能正常运行呢?