【发布时间】:2014-09-25 13:03:23
【问题描述】:
我正在从事一个非常古老的项目,该项目只使用了最低限度的 NIBS。 我添加了新的默认图像,以便屏幕现在加载到 iPhone5 大小,当我在 iPhone5 模拟器上看到图像时确认。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[self.window setFrame:[[UIScreen mainScreen] bounds]];
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
if (standardUserDefaults)
{
if ([[standardUserDefaults stringForKey:@"user"] caseInsensitiveCompare:@"(null)"] == NSOrderedSame)
{
//NSLog(@"Setting user to default_user");
[standardUserDefaults setObject:@"default_user" forKey:@"user"];
[standardUserDefaults setObject:@"default_user" forKey:@"password"];
[standardUserDefaults setObject:@"NO" forKey:@"logged_in_status"];
[standardUserDefaults synchronize];
}
}
UINavigationController *localNavigationController;
self.tabBarController = [[UITabBarController alloc] init];
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:4];
SettingsVC *firstViewController;
firstViewController = [[SettingsVC alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
[localNavigationController.tabBarItem initWithTitle:@"Settings" image:[UIImage imageNamed:@"icn_new_request.png"] tag:1];
firstViewController.navigationItem.title=@"Settings";
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[firstViewController release];
VideoMenuVC *secondViewController;
secondViewController = [[VideoMenuVC alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController];
[localNavigationController.tabBarItem initWithTitle:@"Video" image:[UIImage imageNamed:@"icn_existing.png"] tag:2];
secondViewController.navigationItem.title=@"Video";
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[secondViewController release];
LoginVC *thirdViewController;
thirdViewController = [[LoginVC alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:thirdViewController];
[localNavigationController.tabBarItem initWithTitle:@"Log On/Off" image:[UIImage imageNamed:@"icn_phone.png"] tag:3];
thirdViewController.navigationItem.title=@"Log On/Off";
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[thirdViewController release];
self.tabBarController.viewControllers = localControllersArray;
self.tabBarController.selectedIndex = 1;
[localControllersArray release];
self.user_name = [[NSString alloc ]init];
self.user_name = @"defaultFolder";
NSLog(@"Frame Height: %f",self.window.frame.size.height);
NSLog(@"Tab Height: %f",self.tabBarController.view.frame.size.height);
NSLog(@"Tab Origin Y: %f",self.tabBarController.view.frame.origin.y);
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
当 Launch 图像出现时,它占据了 iPhone 5 Simulator 屏幕的整个区域。
当应用程序完全加载并显示 VideoMenuVC 时,您可以看到它没有使用完整区域。标签栏下的白色区域不应该在那里。
虽然查看视图高度的 NSLog,但它们似乎是正确的。
我已经看了几个小时了,也许我看不到明显的东西,因为我看得太难了。对于我做错了什么,我会很感激一些新鲜的眼睛/想法。
非常感谢, 代码
【问题讨论】:
标签: ios objective-c iphone ios6