Is there a way to change Notification Center's orientation? - ios

My client asked me to rotate just labels and buttons when device is rotated. I turned auto-rotation off and made some affine transforms on the labels and buttons during the device rotation. But iOS thinks my app is in portrait orientation always, so the Notification Center can be dragged with finger from upper part of iPhone/iPad only and it is in portrait orientation always. Is there a way to change Notification Center orientation?

Related

How to detect device rotation despite locked display orientation?

So I have an app that needs to not use autorotate. Instead of rotating the screen the buttons on the screen are just supposed to rotate.
I have the interface locked in landscape left. How do I detect what rotation the buttons should be?
I am using a custom opengl engine so I can set the rotation of objects.
You can get the device orientation from:
UIDevice.orientation
This is not the interface orientation, so you get two more possible values for face up and face down. Also the landscape left and right are swapped compared to UIInterfaceOrientation.
You can listen for changes in device orientation by subscribing to the UIDeviceOrientationDidChange notification from NSNotificationCenter. You may have to enable these notifications by calling UIDevice.beginGeneratingDeviceOrientationNotifications().
If the interface orientation is locked on the device, it is not listening to any delegate methods related to orientation changes.

Make some views independent to orientation change

How Can I make some of my UIViews to be orientation independent and some of them dependent. I'm looking for effect similar to this in standard iOS 9 Camera App when user change orientation from Portrait to Landscape. In Camera View Controller only left Icons and Right Icons are rotating but the internal view stays on position independently.

AutoLayout does not function correctly when phone rotated 360 degrees

I am having an issue with "autorotation". I have AutoLayout constraints that function correctly if the phone is rotated from Portrait to Landscape Left or Landscape Right. But if the phone is rotated from either landscape orientation to the other landscape orientation but going "360 degrees" instead of back into portrait first, then the layout looks like it thinks the phone is in Portrait Orientation.
I'm allowing all orientation except upside down. I've tried enabling upside-down orientation but the phone never rotates into that orientation, it just stays in landscape.
What is the appropriate way to deal with this?
I abandoned the approach using AutoLayout and instead used UIView + NSAutoLayout. This let me easily set all the constraints programmatically and everything worked much better.

UIDeviceOrientationDidChangeNotification event not firing when user disable screen auto-rotation

I can receive UIDeviceOrientationDidChangeNotification event, if auto-rotation is set.
But when screen auto rotation is disable, orientation notification doesn't work any more.
The effect I want to achieve is as iPhone Camera and Camera+: whatever the user lock or not lock the screen rotation, application can correspond to the rotation change immediately and correctly.
Does anyone has any idea why notification not sent when user lock the screen rotation?
How could I correspond to the device orientation change even if auto-rotation is disabled?
I also want to get the effect of the Camera app, where the app detects the orientation of the device even if the user has set Portrait Orientation Locked. UIDeviceOrientationDidChangeNotification is not posted when the user has portrait orientation locked. I believe the only way to determine the orientation of the device when the user has locked the orientation to portrait is to manually work out the orientation using UIAccelerometer.
The list of questions & answers below are all related to this issue. I found them when I was searching for an answer, and you might find them helpful too.
Related questions:
How to detect Camera Overlay view rotation
How to do Orientation Detection even the device has locked orientation
Detect iOS device orientation lock
Detect iPhone screen orientation
Callback method on auto rotation, iOS and iPad

iOS Support Multiple Rotations without Animation

I am recreating the Camera app interface for my iPhone app. When it is rotated on its side, instead of rotating the entire UI, I only rotate the icons, just like the normal camera app does. This has worked just fine, but with iOS 5 the notification center orientation depends on the app's orientation. Since my app technically stays in portrait orientation, you can only access the notification center from the top of the screen, even when held sideways. The default camera app has somehow avoided this problem.
I figured the best way to do this is to silently update the UI to be in a different orientation, but from the user's perspective only the icons update. I've tried to achieve this by returning YES in shouldAutorotateToInterfaceOrientation:, and then setting the transform property to rotate the view in willAnimateRotationToInterfaceOrientation:duration:. This works, except it shows an animation where it moves the newly rotated view to its proper position. How can I achieve this without any visible animation?
The answer is actually very simple. All I had to do was change the statusBarOrientation property on [UIApplication sharedApplication] to whatever UIInterfaceOrientation I wanted.

Resources