笔记-横竖屏切换

场景:小demo,实现横竖屏切换

步骤:

1. AppDelegate.m:添加:

- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window

{

        return  UIInterfaceOrientationMaskAll;

}

2. 在想要设置横竖屏的页面添加:

- (BOOL)shouldAutorotate{

    return YES;

}

//支持竖屏方向,同理可设置支持横屏或其他

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {

  return UIInterfaceOrientationMaskPortrait;

}

你可能感兴趣的:(笔记-横竖屏切换)