导航栏下方的空白区域

Mer*_*lut 1 xcode uinavigationbar ios

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;
}
Run Code Online (Sandbox Code Playgroud)

小智 8

我想知道我是如何解决这个问题的,因为它很容易且效果很好.

在故事板中选择获取不透明导航栏下的空白的视图控制器.

然后转到"属性检查器" - >"查看控制器" - >"扩展边缘" - > 选中"在不透明条纹下"框