Status bar rotates twice when changing interface orientation - ios

I have an iPad app which supports only Landscape (left and right) orientations. When rotating the device the status bar should rotate together with the interface (180°), but it actually rotates twice (180° + 360°).
Happens only in iOS 8, on lower versions there's no such problem. I was able to reproduce this in Photos app as well. Anyone knows how to work around this?

Related

App Orientation in iOS9 Split View

I'm looking at how my app will run in Split View on an iPad Pro.
I use constraints for layout, but sometimes I want to know the window orientation in order to tweak the layout by modifying a couple of constraints.
Things are easy to handle if the user rotates the device (I handle the call of viewWillTransitionToSize), but the app has to know its initial orientation.
Until now, I have been using the status bar orientation to determine the device orientation:
UIInterfaceOrientation o = [[UIApplication sharedApplication] statusBarOrientation];
But this doesn't seem to work properly in Split screen mode on the iPad Pro simulator. The problem is that the device is in landscape mode, and the statusbarOrientation call says the app is in landscape mode. But my app is using half the screen, so it needs to do layout as if it's in portrait mode.
If I check the bounds size of myViewController.view, this seems to give the right answer, even if the device has not been rotated. In the bad old days I seem to remember that we couldn't rely on this unless the device had been rotated at least once.
So what's the right way to determine the orientation of my App window in iOS9?

iOS 8 rotation hides status bar, iOS 7 works fine

I have an app that I need to restrict one screen to be portrait only. I do this by always returning no in shouldAutoRotate. However, on iOS 8, when I rotate the device, it hides the status bar, but keeps the rest of the view locked to portrait.
In iOS 7, everything works fine. Nothing rotates when I rotate the device any which way.
I've tried disabling rotation system wide, and that works fine, so somehow, in iOS 8, the rotation separately checks for the views and then for the status bar to rotate (or maybe for the navigation controller, which includes the status bar? I'm not sure.)
Any help or ideas as to where to look to get my status bar to also lock to portrait in iOS 8 would be greatly appreciated!
Edit: So, it seems what is going on is that my VC is not rotating, its views are staying the same. However, the status bar orientation is changing from portrait to landscape. I'm figuring this out using NSLogs to check out the orientation, and even though shouldAutoRotate is returning NO no matter what, the status bar is still changing orientation.
Any ideas on how to stop the status bar from also rotating would be great!

iOS 8 Screen slides wrong direction when back button tapped

My application was written for iOS7 and I am trying to get it updated to iOS 8. My application is configured to only work in Landscape Left and Landscape Right orientations.
For iOS 8 I changed the order by which the screens are navigated and changed one of the modal screens to a push transition. On the main screen I have two UIBarButtonItems on the UINavigationItem. Each of these have a push segue assigned to them that connects to different screens.
When the app is running and one of the UIBarButtonItems is tapped, the screen associated through the segue slides over the main screen as expected. The back button is displayed normally. The problem occurs when the back button is tapped. The screen does not slide off to the right as would be expected.
On an iPhone 4 running iOS 7 the screen always slides down (towards the ground) regardless of the devices landscape left or landscape right orientation.
On an iPhone 6 Plus running iOS 8 the called screen quickly rotates to Upside Down (top towards the home button) and then slides off to home button side. Again it doesn't matter which way the phone is oriented landscape left or landscape right orientation.
I have tried setting the preferredInterfaceOrientationForPresentation, shouldAutorotate to NO, and setting the supportedInterfaceOrientations to UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeRight. Nothing seems to make any difference at all.
My screen navigation is straight forward, I'm no using any custom transitions. It's all through standard push segues.
I need to get the screen "back" transitions working correctly again.
Any help is greatly appreciated!
I have finally discovered what was causing my screens to slide the wrong direction. It turns out that overriding the supportedInterfaceOrientations method in the UIViewController and returning UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft confuses the transition in iOS 8 (and devices running iOS 7 also). This was needed for proper operation in iOS 7, but evidently causes problems in iOS 8. So once I removed the code, the screen transitions began working correctly again.

How to rotate iOS MKMapView so that it north-oriented when switching tracking mode?

I am working on an iPad app (iOS 5.1), and I use MKMapView to display a map in my app.
I am switching between the three different map orientation modes using MKUserTrackingModeNone, MKUserTrackingModeFollow, MKUserTrackingModeFollowWithHeading and this works.
However I have a problem with the orientation of the map not resetting to north-facing orientation (north on the map being at the top of the screen) when switching from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone.
On the built-in maps app on the ipad, the flow is like this:
When you start the app it is in mode MKUserTrackingModeNone and is north-oriented
When you toggle the orientation mode it changes to MKUserTrackingModeFollow, and the orientation is still north.
When you switch again, it changes to MKUserTrackingModeFollowWithHeading, and the map rotates according to the direction you are facing/pointing the iPad.
When you switch orientation again, it goes back to MKUserTrackingModeNone, and the map nicely rotates back to being north-oriented.
I would like my app to behave in the same way in regards to orientation when switching mode, but when I do as in step 4 above and switch from MKUserTrackingModeFollowWithHeading to MKUserTrackingModeNone, the orientation stays as it was just before making the orientation switch instead of rotating back to north orientation.
I am making the orientation switch with the standard MKUserTrackingBarButtonItem control placed in a toolbar.
Any ideas of how to solve this?
Thanks!
Are you using the standard iOS button bar item for doing this? My app does and as soon as I tap it from followWithHeading to non it rotates back to north is up.
This is a quick fix that works, though it's not very elegant:
https://stackoverflow.com/a/16576802/2077435

shouldAutorotateToInterfaceOrientation gets called but app interface does not reorients (only the status bar reorients)

I am trying to build an app that only works for landscape device orientations on iOS devices. That means my shouldAutorotateToInterfaceOrientation returns true for only landscape device orientations. However at some points of time, I need to switch to portrait device orientation for which I use setStatusBarOrientation API.
After holding the device in any landscape orientation and setting the interface orientation to default/upside down by using setStausBarOrientation API, and just tilting the device slightly in the held orientation orientation only, the status bar rotates but the interface does not rotates. shouldAutorotateToInterfaceOrientation does get called and returns true but still interface does not reorient. Also, problem gets solved if I rotate the device in opposite orientation. I am not sure what I am doing wrong.
Apple have accepted this as a bug in their SDK and they might fix the issue in the next release.

Resources