Hello my whole app is for landscape orientation not for portrait and in one screen I used UIImagePickerController so I set Potrait, Landscape Left and Landscape Right from Target's general Deployment info. My code in AppDelegate.swift is
internal var shouldRotate = true
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
if shouldRotate {
return UIInterfaceOrientationMask.Landscape
}
else {
return UIInterfaceOrientationMask.Portrait
}
}
I want to rotate be UIImagePickerController so am doing like this whenver I want to present UIImagePickerController :
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.shouldRotate = false
picker?.allowsEditing = true
picker!.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
self.presentViewController(picker!, animated: true, completion: nil)
through this code I am able to rotate UIImagePickerController. But now issue is when I present UIImagePickerController my ViewController is LandscapeLeft and after presenting of UIImagePickerController I rotate my device and UIImagePickerController is also rotating(which is fine) and after picking of image I dismiss UIImagePickerController now problem is viewcontroller is in LandscapeRight Orientation which should be LandscapeLeft because when I present UIImagePickerController it was in LandscapeLeft orientation. sorry for my english please help me.