Viewcontroller does not respond to messages related to screen conversion.
Luo chaohui (http://blog.csdn.net/kesalin)
Reprinted please indicate the source
Some people raised the following question on cocoachina: A viewcontroller contains a B viewcontroller (B's view is used as the subview of A's view). During Horizontal and vertical screen conversion, A can get messages related to screen rotation (for example:Shouldautorotatetointerfaceorientation), And
B is not available, even if a and B Implement these functions. Original post see here: http://www.cocoachina.com/bbs/read.php? Tid = 40973 & page = 1 #393765.
I have encountered this problem before. I have studied it a little because a is in the Controller hierarchy of the window in appdelegate (for example, it is implemented by navigation push ), B is just created to make it easier for a to use its view. B is not added to this hierarchy (B's parentviewcontroller is nil, even if B. view. superview is. view ). So a will follow that hierarchy to get the message related to system rotation, while B will be cooler at one side and will not receive the message.
There are three solutions:
First, add B to the Controller navigation level;
The second is to implement all rotation-related messages in a, and explicitly call related messages of B in the messages implemented by;
Third, the layoutsubviews function of B is explicitly called in layoutsubviews of A. In layoutsubviews message implementation of B, the layout is adjusted based on the orientation of statusbar. This method only adjusts the layout of B and does not actually change the value of orientation of B.