一、设备旋转(上苹果商店有风险)
*这种方法当在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);