简体   繁体   中英

Setting NavigationBarHidden to NO doesn't resize the view correctly iPhone/ipad

I've got this simple problem that is really making me crazy.
I've got a navigation controller, the root view controller is a VC that has a view that should be presented without displaying the navigation bar. To achieve that I've set the navigationBarHidden property of the navigationController bar to YES in the -viewWillAppear: method, inside the rootVC.

To display it again I've set in the -viewWillDisappear: method of the rootVC the same property to NO.

If I ask the view its frame.size it will answer correctly 320 width and 460 height. When I push another view (I can see navbar appear) if I ask the view for its size it says me that is 320x460 and this wrong it should tell me something like 320x416.
If I push another view and ask for its size now I get the correct size 320x416. If now I pop pressing back I get again the correct size.
The fact is that the "middle" view is overlapped for 44 points by the navigation bar and I'm not able to make it the correct size except for hardcoding its size and I don't want.
The view autoresizing mask is blocked by IB because is the one of the file's owner. The status bar style is blck opaque.
Do you have some hints for me?
THX, Andrea

尝试在第二个视图而不是第一个视图中将该属性设置为YES。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM