【问题标题】:Navigation bar not showing to the top edge in iOS11 iPhoneX simulatoriOS11 iPhoneX模拟器中导航栏未显示到顶部边缘
【发布时间】:2017-11-06 09:17:17
【问题描述】:

我遇到了这个问题,过去几天我找不到答案。

导航栏在 iOS 11 模拟器中没有显示到 iPhone X 的顶部边缘,这是模拟器错误还是我做错了什么?

身高88

身高145

没有背景图片

这是我在 appdelegate 中的代码

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
UIImage *navImage = [[UIImage imageNamed:@"iPhone-Navigationbar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
[[UINavigationBar appearance] setBackgroundImage:navImage forBarMetrics:UIBarMetricsDefault];

【问题讨论】:

    标签: ios objective-c iphone xcode ios11


    【解决方案1】:

    奇怪的行为,几个想法:

    • 您是否尝试过移除背景图片?
    • 背景图片有多大? iPhone X 上的导航栏更高 (145pt)。

    【讨论】:

    • 试过去掉所有背景还是一样的问题,导航栏图片的高度是88px,264@3x,view的背景图片是812px
    • 在 iPhone X 上,导航栏是 145pt。
    • @IQaid 发布带有 setBackgroundImage 评论的截图。我希望看到一个系统灰色导航栏。如果不是,您仍在其他地方编辑它。
    • 我用更多屏幕截图编辑了我的问题@Shebuka
    • @IQaid 这意味着您的窗口或根视图放错了位置。检查你的约束。
    猜你喜欢
    • 2020-09-09
    • 2020-10-18
    • 1970-01-01
    • 2020-03-04
    • 1970-01-01
    • 2014-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多