http://www.cnblogs.com/niit-soft-518/p/5611298.html
支持特殊页面的横竖屏,上述文章的强制横屏是不够的,因为状态栏会转,手横屏拿着打开页面页面会乱。需另外添加
1.AppDelegate.m设置:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//初始设置支持竖屏
[DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return [DeviceUlity sharedInstance].orient;
}
2.进入某个支持横竖屏的viewController,
-(void)loadWithUrl:(NSURL*)url preview:(BOOL)preview
{
//进入时设置支持横竖屏
[DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeRight;
}
-(void)clickBack:(id)sender
{
//退出页面时设置只支持竖屏
[self.navigationController popViewControllerAnimated:YES];
[DeviceUlity sharedInstance].orient = UIInterfaceOrientationMaskPortrait;
}
网友评论