导航控制器栏正在被切断 [英] navigation controller bar is being cut off

查看:119
本文介绍了导航控制器栏正在被切断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果通过在应用程序启动期间选择状态栏样式=隐藏来隐藏状态栏,我将自定义uinavigation栏,如下所示

If hiding the status bar by choosing status bar style = hide during application launch and I am customizing uinavigation bar like the following

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                       forBarMetrics:UIBarMetricsDefault];

当我得到这个时:导航栏被切掉了顶部。

and when I am getting this : the navigation bar is cut off the top.

关于这种情况以及如何解决这个问题的想法?

Any ideas about this situation and how to fix it ?

推荐答案

您可以尝试这个。

You can try this.

在应用程序启动期间。这里viewController是UINavigationController。

during application launch. here viewController is UINavigationController.

//set status bar hidden true.
    [[UIApplication sharedApplication]setStatusBarHidden:YES]; 

//You can set navigation bar frame to start from 0.0,0.0
    self.viewController.navigationBar.frame = CGRectOffset(self.viewController.navigationBar.frame, 0.0, -20.0);

//set the image u want.
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                       forBarMetrics:UIBarMetricsDefault];

[[UIApplication sharedApplication]setStatusBarHidden:YES]; 
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                           forBarMetrics:UIBarMetricsDefault];
[self.viewController setWantsFullScreenLayout:YES];

这篇关于导航控制器栏正在被切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆