[英]Is it possible to allow only specific orientations based on view controller on iOS 13?
[英]Custom Orientations on a specific view controller
我的應用程序中有很多視圖控制器(支持所有方向)。 其中一些視圖控制器的內容太多,無法適應景觀。 我如何將某些視圖限制為縱向,同時還要具有縱向和橫向。
PS:我使用的是Objective-C,並且看到了很多快速的答案,但是我不擅長翻譯Swift-> Obj-C
這取決於您的視圖控制器層次結構的設置方式。
例如,如果您有一個UINavigationController
作為窗口的rootViewController
,則可以有一個UINavigationControllerDelegate
,它返回導航控制器的topViewController.supportedInterfaceOrientations
。 然后,在你僅有縱向視圖控制器,你將返回UIInterfaceOrientationMaskPotrait
在supportedInterfaceOrientations
,並UIInterfaceOrientationMaskAll
在您的視圖控制器的其余部分。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.