On iOS 8 I have a strange behavior regarding the navigation bar and orientation changes.
I have a navigation controller which reports a supported interface orientation <
For lack of a better option I've done a bit of a hack for this. Basically before I show the modal view I take a screen shot and lay it on top of the presenting view controller.
Obviously I have to remove this screen shot when the view re-appears
func showScreenShot () {
let image = screenShot()
self.screenShotImageView = UIImageView(image: image)
self.view.addSubview(self.screenShotImageView!)
}
func screenShot () -> UIImage {
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, true, UIScreen.mainScreen().scale)
self.view.layer.renderInContext(UIGraphicsGetCurrentContext())
let image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image
}
func removeScreenShot () {
if let screenImageView = self.screenShotImageView {
screenImageView.removeFromSuperview()
self.screenShotImageView = nil
}
}