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;
}