我必须针对 iPhone 5 屏幕尺寸优化我的一个旧项目。RootViewController 没有 XIB。我在应用程序 didFinishLaunchingWithOptions: 方法中尝试了一些技巧。但没有任何效果。
这是应用程序 didFinishLaunchingWithOptions: 方法的代码。** 注意:注释行是我尝试过的技巧
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self createEditableCopyOfFileIfNeeded:@"ChapterInfo.plist"];
mainWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
// [mainWindow setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
// [mainWindow setAutoresizesSubviews:YES];
readerDemoController = [[ReaderDemoController alloc] initWithNibName:nil bundle:nil]; // Demo controller
// [readerDemoController.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
// [readerDemoController.view setAutoresizesSubviews:YES];
navigationController = [[UINavigationController alloc] initWithRootViewController:readerDemoController];
UIImage *imgeBack = [UIImage imageNamed:@"back.png"];
mainWindow.backgroundColor = [UIColor colorWithPatternImage:imgeBack]; // Window background color
navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
[navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"titlebar.png"] forBarMetrics:UIBarMetricsDefault];
navigationController.navigationBar.translucent = YES;
// [navigationController.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
// [navigationController.view setAutoresizesSubviews:YES];
mainWindow.rootViewController = navigationController; // Set the root view controller
[mainWindow makeKeyAndVisible];
return YES;
}
如果不从一开始就进行项目,我该如何克服这个问题?请给我一些帮助。