导航栏未显示在iOS11 iPhoneX模拟器的顶部边缘 [英] Navigation bar not showing to the top edge in iOS11 iPhoneX simulator

查看:68
本文介绍了导航栏未显示在iOS11 iPhoneX模拟器的顶部边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几天里,我一直找不到这个问题的答案.

I'm having this problem with i couldn't find an answer for it in the past couple of days.

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

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 ?

高度88

高度145

没有背景图片

这是我在appdelegate中的代码

And this is my code in 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:

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

这篇关于导航栏未显示在iOS11 iPhoneX模拟器的顶部边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆