屏幕翻转方案:
手动翻转:按钮触发:
- (IBAction)totate:(id)sender {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
self.view.transform = CGAffineTransformMakeRotation(M_PI/2);
self.view.bounds = CGRectMake(0, 0, 480, 320);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscapeRight ;
}
自动翻转:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscapeRight ;
}
本文探讨了屏幕翻转技术的两种实现方式:手动通过按钮触发和自动响应设备旋转,详细介绍了对应的Swift代码实现,适用于iOS应用开发者。
504

被折叠的 条评论
为什么被折叠?



