場(chǎng)景:小demo级解,實(shí)現(xiàn)橫豎屏切換
步驟:
1. AppDelegate.m:添加:
- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
?? ? ? ?return? UIInterfaceOrientationMaskAll伊约;
}
2. 在想要設(shè)置橫豎屏的頁(yè)面添加:
- (BOOL)shouldAutorotate{
? ? return YES;
}
//支持豎屏方向,同理可設(shè)置支持橫屏或其他
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
? return UIInterfaceOrientationMaskPortrait;
}