在plist中可以设置你的app支持几种方向,设置以后在程序中可以响应到这类方向调整。不过这种方式必须设置支持旋转 并且子controller想要旋转必须它的父controller也必须支持旋转。 在项目开发过程中经常会遇到有些页面要支持横屏可它的父controller不要支持横屏,这种情况很难处理
一下这种方式可以一试
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]
addObserver:(id)(iOSRotationNotificaiton::getInstance()->m_delegate) selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:[UIDevice currentDevice]];
在需要支持旋转的controller中加入观察