【问题标题】:Converting old App to iPhone5. Tabbar floats above the bottom of the screen. Screen has resized to iPhone5将旧应用程序转换为 iPhone5。标签栏浮动在屏幕底部上方。屏幕已调整为 iPhone5
【发布时间】: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


    【解决方案1】:

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

    【讨论】:

    • 您是指用户启动应用所使用的应用图标图片?
    • 不,我谈到了标签栏图标,例如 icn_new_request.png
    猜你喜欢
    • 2012-11-14
    • 2011-02-16
    • 1970-01-01
    • 2012-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多