these days i start to learn iOS rotation, in the whole process, i am quite confused, today through some experiments, i thought i start to understand something.
first let me says something interesting to me, when i use WeChat, i find that the orientation of the app is often portrait, but when i go to details of a subject in Fenng's official account, and i rotate the device, then the view rotate too. here is the two snapshot:


here my question is how to control view's orientation?? how to let most views portrait only but a special one???
in order to understand the theory behind the scene. i wrote some test code, the test code is atgithub, you can download them from there. you can analysis the code yourself, here is some hint:
- in iOS 6 when device rotates, it only ask the root controller whether it should rotate and what orientations it supports
- there is two places defines the orientations the app supports, info.plist or application delegate and view controller
- when a device rotates, the app receives two notifications.
本文探讨了iOS应用中视图旋转的控制方法。作者通过实验发现,大部分视图保持竖屏显示,但在特定场景下(如查看公众号文章)允许横屏显示。通过分析测试代码,揭示了iOS设备旋转时如何判断和响应不同方向。


被折叠的 条评论
为什么被折叠?



