ltebean / LTNavigationBar

UINavigationBar Category which allows you to change its appearance dynamically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

适配iPhone X的导航条显示不全

huangwangxin opened this issue · comments

今天在iPhone X模拟器上跑,导航栏显示不全。
在UINavigationBar+Awesome.m文件中31行改为如下:
CGFloat height = [UIApplication sharedApplication].statusBarFrame.size.height;
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + height)];

这样改合适吗?

commented

在iPhone X模拟器下运行的结果
(lldb) po self.bounds.size.height
44
(lldb) po [UIApplication sharedApplication].statusBarFrame.size.height
20
结果还是之前的64 , 求大神解释下.

@zzcshao [UIApplication sharedApplication].statusBarFrame.size.height == 20的问题可能是你没有适配iPhone X,你要在Assets添加启动图,尺寸1125x2436像素。 这样子适配iPhone X,statusBarFrame.size.height的高度就为44像素了

@h1101723183 我提了一个新问题 请问适配iOS 11的时候 你遇到了么