Closed MQZHot closed 6 years ago
在viewDidLoad和viewDidAppear中打印self.navigationController.navigationBar,为什么frame是不一样的,求教
viewDidLoad
viewDidAppear
self.navigationController.navigationBar
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>>
iPhone X 吗?viewDidLoad 时只是创建实例,可能还没有布局好吧。在 viewDidLayoutSubviews 或 viewWillAppear 中打印试试?
viewDidLayoutSubviews
viewWillAppear
楼主解决了吗,或者换了什么方式解决的
我在viewDidLayoutSubviews中解决了
在
viewDidLoad
和viewDidAppear
中打印self.navigationController.navigationBar
,为什么frame是不一样的,求教