iOS: Change Orientation only for few pop-up views - ios

I have an app which runs only in Landscape mode. All working well. But I have few pop-up views like Apptentative feedback view and Twitter Sheet view, works great when in portrait mode. So how can I change orientation forcefully when loading these pop-ups and back to landscape when these pop-up closes.

You can't force an orientation change. You can only support changes in orientation. IE moving the device 90 degrees to the right.

Related

How to force a form to landscape and back to portrait after close the form on IOS

I need to force a form to open in landscape (take photo) and back to portrait when the photo is taken. I am setting the project to use landscape and inverted landscape, but this resource only works when I move the device manually.
Any suggestions? On android works perfect changing the form factor.

How do you launch an iOS app in the current device orientation?

I'm working with Xamarin and am having troubles launching my app in the current device orientation.
I have a UINavigationController that I set on my main UIWindow as the root controller. I created a custom UINavigationController which overrides the methods :
GetSupportedInterfaceOrientations
and
ViewWillTransitionToSize
If I hold my iPad in landscape mode and start the app, it will start in portrait mode and then rotate in landscape. I'd like to make it start in the same orientation as the device's physical orientation. From the doc I've read it seems that since iOS 8, everything related to rotations should be handled in the root uiview controller which is my custom UINavigationController.
And here's my problem... let's say I want to start my app in the current device's orientation and then block everything except Portrait once the app is loaded. I tried the 2 following solutions and none worked.
1- I put all interface orientations available in the supported interface orientations key in the info.plist file. I launched the app while holding the iPad in landscape mode. In this case, my app starts in the same orientation as the device which is cool. What is not cool is that it doesn't call my navigation controller method GetSupportedInterfaceOrientations anymore. So even if I change the return value of that method to Portrait only later one, it does absolutely nothing since the method is never called anymore.
2- I removed all supported interface orientations from the info.plist file. I lauched the app while holding the iPad in landscape mode. In this case, my app starts in portrait mode and then rotates to landscape. I want to prevent the rotation and just start the app in the current device's orientation (landscape). With this setup though, I can later change the supported orientation as the navigation controller method GetSupportedInterfaceOrientations is being called everytime we try to rotate the app.
In apple's doc, it says "At launch time, apps should always set up their interface in a portrait orientation. After the application (_:didFinishLaunchingWithOptions:) method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window."
The part where the view rotates to the appropriate orientation PRIOR to showing the window doesn't seem to work for me. It shows the window and then rotates it after.
So how do you launch an app in the current device's orientation (without the user seeing your first view rotate from portrait to whatever) and then be able to change the supported orientations later in the app? Example : I hold my iPad in landscape mode. I launch my app. First view I see is already in landscape mode. I can then rotate my iPad to change the view in portrait/landscape back and forth. Then I click a button which changes the supported orientation to Portrait which prevents me from changing the orientation to Landscape anymore.
Thanks!

Status bar and UI orientation didn't match

I have a problem in iOS. It's support all interface orientations. But when orientation-locked modal controller is presented (by calling [self presentViewController:UIViewController animated:YES completion:nil]), sometimes the UI orientation is messed up.
Here are the steps:
Orientate the device so it's in portrait mode (doesn't matter portrait or upsideDown).
Present view controller as modal controller. This controller only support landscape mode. The UI orientation obviously rotated to landscape. Keep the device in portrait (since the controller is forced to landscape, the UI will still show a landscape UI eventhough the device is in portrait).
Dismiss the modal controller. Now the main UI is in landscape mode. The problem is, this main UI is supporting all orientations (like stated above).
After doing some interaction (without changing the device orientation), the device orientation suddenly back to portrait, but the UI does not follow suit.
Here's how the final screenshot:
My current thought is that this is iOS bug. I want to look for another opinions regarding this bug. I've search around the net (bing and google) and found nothing.
I often saw this in apps, sometimes even in iOS itself (on homescreen etc)..
I think it's an iOS bug and we as developers can nothing do about it, just write bug reports.

Ipad view Alignment

In my iPad app, i am supporting only portrait mode except on one screen. I have tab bar at bottom, on click of any tab,it opens a small view of size 320.0 * 600.0, with table view. On selecting any row in small view, a full screen view opens up. Problem is that when i came on full screen view which supports all orientations, next time,my other view especially the small view comes up with frame size of 768 * 1024.
Any sugeestions or help is appreciated!
I'm guessing the problem is that you read the frame size while still being in landscape mode. If you are running things in the simulator, it probably jumps back to portrait when you dismiss the full screen? This forces the app back to "portait" mode without triggering the normal "willRotate" functionality, and could possibly mess up your code for keeping track of orientations.
Also keep in mind that most apps needs to support all orientations on the iPad to get accepted, unless you're making e.g. a game which is normally specifically designed for either landscape or portrait.

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

Resources