繁体   English   中英

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

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

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

导航栏未显示在iOS 11模拟器中iPhone X的顶部,这是模拟器错误还是我做错了?

身高88

屏幕截图1

身高145

屏幕截图2

无背景图片

屏幕截图3

这是我在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];

奇怪的行为,有两个想法:

  • 您是否尝试过删除背景图片?
  • 背景图像有什么尺寸? 在iPhone X上,导航栏更高(145pt)。

暂无
暂无

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

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