Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个应用程序,专为纵向设计。但是我不知道如何限制只使用纵向模式,一旦用户倒置或陆地模式,我不希望我的屏幕布局相应地改变。
任何想法如何做到这一点?
可以通过覆盖此方法在 App Summary(以及 rootviewcontroller(无论是 Nav 控制器、TabBar 控制器等)中指定):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); }
这是您可以在 XCode 8.1 中进行更改的位置的更新视图
请注意,您在项目导航器顶部的最左侧选择了该项目(应用程序摘要)。然后,在右侧,您需要确保在顶部选择“常规”,然后根据需要向下滚动,您将看到“设备方向”设置。