IOS开发——强制横屏/强制竖屏

来源:互联网 发布:正方教务网络管理系统 编辑:程序博客网 时间:2024/05/20 18:50

IOS开发——强制横屏/强制竖屏


强制竖屏:

//NS_DEPRECATED_IOS(2_0, 6_0);//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation//{//    return UIInterfaceOrientationIsLandscape(interfaceOrientation);//}//NS_AVAILABLE_IOS(6_0)- (BOOL)shouldAutorotate{    return NO;}- (NSUInteger)supportedInterfaceOrientations{    return UIInterfaceOrientationMaskPortrait;}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{    return UIInterfaceOrientationPortrait;}

//AppDelegate.m//禁止横屏 NS_AVAILABLE_IOS(6_0)- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{    return UIInterfaceOrientationMaskPortrait;}




0 0