When self.navigationController.navigationBar.translucent = NO
,导航栏下方出现空白,如下所示:
我怎样才能删除它?
// From above example
(void)loadUI
{
[self.countriesButton setBackgroundColor:[UIColor colorWithRed:(243/255.0) green:(178/255.0) blue:(128/255.0) alpha:1]];
[self.countriesButton.layer setCornerRadius:10];
[self.countriesButton setClipsToBounds:YES];
/// set attributes for Navigation Bar
self.navigationItem.title = @"Welcome"; // Title of Navigation Bar
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:(243/255.0) green:(178/255.0) blue:(128/255.0) alpha:1];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
self.navigationController.navigationBar.translucent = NO;
}
我要补充一下我是如何解决这个问题的,因为它很简单而且效果很好。
在故事板中,选择在不透明导航栏下获取空白的视图控制器。
然后转到“属性检查器”->“视图控制器”->“扩展边缘”->选中“在不透明条下”复选框
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)