viewController 支援的螢幕方向
/**控制器設定支援的方向 */
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
/**
UIInterfaceOrientationMaskPortrait = 豎屏,
UIInterfaceOrientationMaskLandscapeLeft = 橫屏左邊,
UIInterfaceOrientationMaskLandscapeRight = 橫屏右邊
UIInterfaceOrientationMaskPortraitUpsideDown = 豎屏下邊
UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),橫屏左右邊
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),所有
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
} __TVOS_PROHIBITED;
*/
returnUIInterfaceOrientationMaskAll;
}
// - 設定 viewController 的螢幕方向
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[UIDevice currentDevice] setValue: [NSNumber numberWithInteger: UIInterfaceOrientationLandscapeLeft] forKey:@"orientation"];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[UIDevice currentDevice] setValue: [NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//支援旋轉
-(BOOL)shouldAutorotate{
return YES;
}
//
//支援的方向
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
//一開始的方向 很重要
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeLeft;
}