简体   繁体   English

导航栏未显示在iOS11 iPhoneX模拟器的顶部边缘

[英]Navigation bar not showing to the top edge in iOS11 iPhoneX simulator

I'm having this problem with i couldn't find an answer for it in the past couple of days. 我遇到了这个问题,过去几天我都找不到答案。

The navigation bar is not showing to the top edge of the iPhone X in iOS 11 simulator, Is that a simulator bug or i'm doing something wrong ? 导航栏未显示在iOS 11模拟器中iPhone X的顶部,这是模拟器错误还是我做错了?

Height 88 身高88

屏幕截图1

Height 145 身高145

屏幕截图2

No background image 无背景图片

屏幕截图3

And this is my code in appdelegate 这是我在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];

Strange behavior, a couple of ideas: 奇怪的行为,有两个想法:

  • Have you tried removing the background image? 您是否尝试过删除背景图片?
  • What size background image has? 背景图像有什么尺寸? On iPhone X navigation bar is higher (145pt). 在iPhone X上,导航栏更高(145pt)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM