1 . 比較好的旋轉(zhuǎn)屏幕的方法如下:
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationLandscapeLeft)forKey:@"orientation"];
這樣做的話在模擬器中會發(fā)現(xiàn)模擬器也隨著變成了橫屏
2 .通過setTransform使用戶感覺屏幕旋轉(zhuǎn)
CGFloat height = [[UIScreen mainScreen] bounds].size.width;
CGFloat width = [[UIScreen mainScreen] bounds].size.height;
CGRect frame = CGRectMake((height - width) / 2, (width - height) / 2, width, height);;
[UIView animateWithDuration:0.3f animations:^{
[self.view setTransform:CGAffineTransformMakeRotation(M_PI_2)];
} completion:^(BOOL finished) {
}];