Closed bobbyali closed 9 years ago
I'm tracking the orientation in these lines https://github.com/bobbyali/kidsvidz/blob/master/KidzVids/GridViewController.swift#L151-L154 with this code:
let rotationVal = UIApplication.sharedApplication().statusBarOrientation.rawValue
When I load the simulator (typically iPhone 5/6) and do rotations, I see the following values produced:
Rotated 1 h: 548.0 w: 320.0
Rotated 4 h: 320.0 w: 568.0
Rotated 4 h: 320.0 w: 568.0
Rotated 3 h: 320.0 w: 568.0
Rotated 1 h: 548.0 w: 320.0
i.e. it skips value 2 after two turns (when it is in PortraitUpsideDown mode). When this happens, and the current rotationVal is repeated (either 3 or 4), and the screen height/width attributes don't update properly, the screen doesn't update properly (see screenshot below). I can't figure out why this is happening.
After chat with Tudor:
Deployment settings - need to enable "Upside Down"!
override func supportedInterfaceOrientations() -> Int{
return Int(UIInterfaceOrientationMask.All.rawValue)
}
override func shouldAutoRotate
Also see screenshot at http://monosnap.com/image/2y0Fbcn3G2sQDw6ZmsYPbxAfquzQyi
The screen won't render properly when screen orientation is set to PortraitUpsideDown (i.e. after 2 successive orientation changes in the same direction).