Iphone ios:如何删除导航栏上方的空白栏?
对于自定义导航栏,我需要设置背景图像并自定义左按钮和右按钮。因此,我使用不带.xib的代码对其进行了实例。但导航栏上方有一个空白栏 这是我的密码:Iphone ios:如何删除导航栏上方的空白栏?,iphone,navigation,space,Iphone,Navigation,Space,对于自定义导航栏,我需要设置背景图像并自定义左按钮和右按钮。因此,我使用不带.xib的代码对其进行了实例。但导航栏上方有一个空白栏 这是我的密码: -(void) createNavBar:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { if (!navBar) { navBarController = [[[UINavigationController alloc] in
-(void) createNavBar:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options
{
if (!navBar)
{
navBarController = [[[UINavigationController alloc] init] autorelease];
navBarController.navigationBar.bounds = CGRectMake(0, 0, 320, 40);
[navBarController.navigationBar setBackgroundImage:[UIImage imageNamed:@"www/images/header_bg@2x.png"] forBarMetrics:UIBarMetricsDefault];
[[[self webView] superview] addSubview: navBarController.navigationBar];
}
}
运行并构建,发现导航栏上方有一个空白栏。
以下是一个屏幕截图:
如何删除标题栏和蓝色导航栏之间的空格键?
感谢您的指导。在Xib中检查您的视图和网络视图
Y
和高度
尝试使用以下方法:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
这对我很有用。插入
[self.navigationController.navigationBar.layer setMasksToBounds:NO]代码>在viewDidLoad中仅使用导航栏而不是navigationController尝试。。如果你不使用NavicationController,它的载体、时间和电池信息空间!