I have an iPhone app with structure like "Navigation controller with table -> next view controller with table -> QLPreviewController". By tap in cell of table in first view controller(with navigation controller) appears new view controller with another table, by tap in cell of it shows QLPreviewController.
For example: In first table there are Groups, in second table - Documents of selected Group, and QLPreviewController for previewing selected Document.
Every ViewController in my app must to appear only in Portrait(not upside) orientation, but QLViewController must also support Landscape(left and right).
I'm setting flag canRotate to YES before QLPreviewController appear. In AppDelegate if canRotate == YES
I'm return YES for any Orientation, to rotate QLPreviewController. QLPreviewControllerDelegate in method previewControllerWillDismiss:(QLPreviewController *)controller sets flag canRotate back to NO. But if orientation was Landscape before QLPreviewController dismiss, all of my ViewControllers stay in Landscape orientation...
How can I rotate ViewController back to Portrait orientation in WillDismiss method?