![](/img/trans.png)
[英]How to record landscape video in a portrait application? (Swift 2, iPhone)
[英]How to record video only in portrait in iOS but not in landscape?
我想允許用戶僅以縱向模式(方向)錄制視頻並限制用戶以橫向模式錄制。 我正在使用 UIImagePickerController,但在其中找不到任何方向選項。 誰能幫我解決這個問題?
在AppDelegate
中編寫以下代碼:
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
guard let mainController = navigationController else { return UIInterfaceOrientationMask.all }
if ((mainController.visibleViewController as? CameraVC) != nil) == false {
//This VC should support only Portrait Mode.
return UIInterfaceOrientationMask.portrait
} else {
//Else support All Modes.
return UIInterfaceOrientationMask.all
}
}
並且它會限制您的“ CameraVC
”在橫向模式下旋轉。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.