listenzz / HBDNavigationBar

A custom UINavigationBar for smooth switching between various states, including bar style, bar tint color, background image, background alpha, bar hidden, title text attributes, tint color, shadow hidden...
MIT License
1.65k stars 215 forks source link

更新到1.7.0后 界面都上移了 1.6.9 都没问题 #101

Open deanli08 opened 4 years ago

deanli08 commented 4 years ago

更新到1.7.0后 界面都上移了 1.6.9 都没问题

listenzz commented 4 years ago

1.7.0 以后自动根据导航栏的透明度调整了布局,并且适应了 SafeArea

listenzz commented 4 years ago

检查下导航栏的背景是否透明的

deanli08 commented 4 years ago

没有设置导航透明
[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; image

@listenzz

deanli08 commented 4 years ago

image 这边在viewdidload 里面设置的导航背景颜色

deanli08 commented 4 years ago

image // if (isTranslucent || vc.extendedLayoutIncludesOpaqueBars) { // vc.edgesForExtendedLayout |= UIRectEdgeTop; // } else { // vc.edgesForExtendedLayout &= ~UIRectEdgeTop; // } 注释了 这几行代码就正常了 我的项目基类用的是 self.edgesForExtendedLayout = UIRectEdgeNone;

deanli08 commented 4 years ago
self.hbd_extendedLayoutDidSet = YES;

新的解决方案,在基类中把这个属性设置为YES 也是可以的