将旧应用程序转换为iPhone5。 Tabbar浮在屏幕底部上方。屏幕已调整为iPhone5

时间:2014-08-02 12:56:37

标签: ios objective-c iphone ios6

我正在开展一个非常古老的项目,这个项目只需要最少的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;
}

当启动启动图像时,它会占据iPhone 5模拟器屏幕的整个区域。

当应用程序完全加载并显示VideoMenuVC时,您可以看到它没有使用整个区域。标签栏下面的白色区域不应该在那里。

虽然查看视图高度的NSLog,但它们似乎是正确的。

Image of screen and NSLogs

我已经看了几个小时,也许我看不出这个显而易见的因为我看起来太难了。我很欣赏一些关于我做错了什么的新鲜眼睛/想法。

非常感谢, 代码

1 个答案:

答案 0 :(得分:0)

您的代码中找不到任何可能导致此问题的内容。我会建议检查图标图像的大小。在我的一个项目中,我使用了60 * 60或70 * 60像素的图像。