- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{

    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);

}

- (BOOL)shouldAutorotate

{

    return NO;

}

- (NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向)

}

如果在UIViewController上,则在UIViewController对应的.m文件中加入三个函数即可。

如果在UITabBarController上,则在UITabBarController对应的.m文件中加入三个函数即可。

如果在UINavigationController上,则在UINavigationController对应的.m文件中加入三个函数即可。


相关文章:

  • 2021-07-21
  • 2022-12-23
  • 2022-01-17
  • 2021-10-09
  • 2021-06-29
  • 2021-07-20
  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
相关资源
相似解决方案