首页 > 其他 > 详细

关于屏幕旋转的几种情况

时间:2015-05-23 15:29:11      阅读:244      评论:0      收藏:0      [点我收藏+]

一、设备旋转(上苹果商店有风险)

*这种方法当在General中勾选了Device Orieation 的Protrait后再用下面代码不能设置屏幕旋转至横屏。

技术分享

if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {

    [[UIDevice currentDevice] performSelector:@selector(setOrientation:)

withObject:(id)UIInterfaceOrientationPortrait];

}

 

二、视图旋转(假旋转,将当前视图旋转)

//AppCan应用引擎里边将Config.xml的属性设置为5,仅竖屏显示。<orientation>5</orientation>,将视图旋转至横屏状态,重新设置当前视图bounds值。

 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];

     UIImageView * imagev = (UIImageView*)meBrwView;

     imagev.transform = CGAffineTransformMakeRotation(M_PI*2);

    CGRect frame = [UIScreen mainScreen].applicationFrame;

    NSLog(@"%f,%f,%f,%f",frame.origin.x,frame.origin.y,frame.size.height,frame.size.width);

    imagev.bounds = CGRectMake(0, 0, frame.size.width, frame.size.height);

 

关于屏幕旋转的几种情况

原文:http://www.cnblogs.com/hanyutong/p/4524090.html

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