ViewControllerA ViewControllerB modellerini sunar.iOS - Görüntü denetleyicisinin genel olarak sunulması durumunda aygıt yönlendirmesini zorla
ViewControllerA Dikey yönde olmalıdır.
ViewControllerB, LandscapeRight yönelimi olmalıdır. ViewControllerA:
yapmam
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Portrait
}
override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
return UIInterfaceOrientation.Portrait
}
ViewControllerB
override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
return UIInterfaceOrientation.LandscapeRight
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.LandscapeRight
}
It çalışmaları, ama ViewControllerB kapattığınızda, ViewControllerA LandscapeRight da olur. Nasıl düzeltilir? Thx.
ÇÖZÜM:
Düzenleme AppDelegete dosyası. o ViewControllerB görevden sonra geri Portre Mod gitmek gerektiğinden
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
if self.window?.rootViewController?.presentedViewController is ViewControllerB {
let secondController = self.window!.rootViewController!.presentedViewController as! ViewControllerB
if secondController.isPresented {
return UIInterfaceOrientationMask.LandscapeRight;
} else {
return UIInterfaceOrientationMask.Portrait;
}
} else {
return UIInterfaceOrientationMask.Portrait;
}
}
Çözümünüz doğru olmakla birlikte, farklı yönlerde daha ViewControllers olacak eğer tamamen karışmaya olacaktır:
çözümdür. Çözümümü deneyebilirsin, senaryoda çalışıyor. – KlimczakM