首页 > 其他 > 详细

所有界面锁定屏幕方向,某一个界面支持屏幕旋转~

时间:2015-10-16 11:42:03      阅读:284      评论:0      收藏:0      [点我收藏+]

//appdelagate.h 加
@property (nonatomic, assign) BOOL allowRotation;

 

//appdelegate.m加 
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
  if (self.allowRotation) {
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
  }
  return UIInterfaceOrientationMaskPortrait;
}
- (NSUInteger)supportedInterfaceOrientations
{
  return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
  return UIInterfaceOrientationPortrait;
}

 

打开屏幕旋转:

  AppDelegate  *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

  delegate.allowRotation = YES;

关闭屏幕旋转:

  AppDelegate  *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

  delegate.allowRotation = NO;

 

所有界面锁定屏幕方向,某一个界面支持屏幕旋转~

原文:http://www.cnblogs.com/jyking/p/4884546.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!