rickytan / RTRootNavigationController

Implicitly make every view controller has its own navigation bar
MIT License
2.15k stars 379 forks source link

关于navigationBar的frame问题 #222

Closed MQZHot closed 6 years ago

MQZHot commented 6 years ago

viewDidLoadviewDidAppear中打印self.navigationController.navigationBar,为什么frame是不一样的,求教

2018-09-27 19:45:04.856303+0800 RTRootNavigationController_Example[62757:1937058] <UINavigationBar: 0x7fbcff509450; frame = (0 0; 414 44); autoresize = W; tintColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x600002c910c0>>
2018-09-27 19:45:05.386413+0800 RTRootNavigationController_Example[62757:1937058] <UINavigationBar: 0x7fbcff509450; frame = (0 44; 414 44); autoresize = W; tintColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x600002c910c0>>
rickytan commented 6 years ago

iPhone X 吗?viewDidLoad 时只是创建实例,可能还没有布局好吧。在 viewDidLayoutSubviewsviewWillAppear 中打印试试?

WXXXXH commented 6 years ago

楼主解决了吗,或者换了什么方式解决的

MQZHot commented 6 years ago

我在viewDidLayoutSubviews中解决了