ios 导航栏遮盖控件问题

【问题现象】

导航栏推进到某个ViewController,该ViewController的view的顶部控件被导航栏遮盖。

 

需要对导航栏设置,使ViewController的View坐标自动进行Y偏移,如下:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    UIViewController *vc = [[CMainViewController alloc] initWithNibName:@"CMainViewController" bundle:nil];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    [self.window setRootViewController:nav];
    
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
    {
        // 解决7.0及以上版本导航栏覆盖子视图部分区域
        nav.navigationBar.translucent = NO;
    }
    
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

posted on 2014-01-21 14:01  trako  阅读(439)  评论(0编辑  收藏  举报

导航