Is it possible force UI autorotation in iOS? - ios

I have an auto-rotating view which should be only horizontal at some specific time. I tried changing return value of -shouldAutorotateToInterfaceOrientation: for specific time, but it didn't work as I expected. Because there is no way to force currently vertical oriented UI to horizontal. Is this possible...?

I made a conclusion there is no such thing. I decided to implement rotation manually, myself instead of autorotation. I didn't believed this is possible, but I realized I can do exact things with UIDeviceOrientationDidChangeNotification.
There is -[UIApplication statusBarOrientation] property which looks forces rotation of UI in simulator, but it's just rotating status bar only. However, that's important and preferred for basis for UI orientation by the simulator.
I used it and now rotate everything manually. this is more easier to make and manage.

Related

how to display the zoom-in view in the standard mode of the large-screen phone

Recently I was asked to adapt to large-screen phones because the standard mode view looks too small on large-screen phones. So I thought of a simple way: display the zoom-in view in the standard mode of the large-screen phone. But i can't find a good way to realize it.
The original idea was to set the currentMode setting of UIScreen, but iOS does not support the creation of external UIScreenMode...
If you are not using a storyboard, use code with frame. You can use masonry, use multipliedBy. If you don’t change anything code and want to directly adapt, that’s unlikely.

iOS Maps UIPopover misplaced after orientation change

we are working on a tablet app and have the following problem:
We are using popover controllers if the user touches a pin on the map but after orientation change, the popover is misplaced. But we cannot keep a reference because after orientation change, the pins are reloaded.
Did someone already have this problem and found a generic solution for this? I wonder how apple is handling this.
Generally the placement of popovers after orientation change is sometimes acting a bit strange.
thanks in advance
A common approach is closing the popover after rotation. Unfortunately there's not going to be much you can do that wouldn't require some complicated repositioning logic. Perhaps store the origin point as an iVar and calculate the new coordinates based on the new orientation. There's no generic solution for this, however.

How is the in-call status bar impacting my CGAffineTransform'd view?

My app (target iOS 5+, uses ARC and storyboards, for the App Store) uses some rotation transforms. There's a bug where an in-call status bar (such as if there's an ongoing phone call or microphone recording) causes the views to mutate beyond what the transform describes. To diagnose the problem I wrote a simple test app* that plays with a view's transform.
Initially (reproduced in simulators 5.0 and 6.1, and hardware 6.1) it looks like
After rotating by 20 degrees:
Still ok! But something weird happens when I toggle the in-call status bar (command-T):
Ok, well maybe it'll revert if I turn off the in-call status bar
Disaster! Let's try resetting the view's transform to CGAffineTransformIdentity
Oh what have I gotten myself into?!
Anyway, I'm new to CGAffineTransforms, and Quartz 2D as a whole, so I'd appreciate if someone could tell me why this is happening. The code is available on Github* if you want to poke around.
*Note that the code has been updated with a solution.
This is happening because toggling the in-call status bar changes the view frame, which (if it's set to autoresize subviews) autoresizes subviews accordingly. If the transformed view has any flexible margins, it could skew as shown in the above screenshots. To make it not skew like that, turn on all four struts.

How to start a landscape iOS app in the correct orientation without rotating?

I'm developing a landscape-only, iPhone-only iOS6+ app and having problems getting the rotation to work as I want it to.
The only supported interface orientations set for the app target are Landscape Left and Right. I only have a single view controller at the moment, with its -supportedInterfaceOrientations method simply returning UIInterfaceOrientationMaskLandscape. The info.plist file does not have the UIInterfaceOrientation key.
What I'd like to happen is that after the launch image disappears and the initial view controller is displayed, it is immediately displayed correctly in the orientation in which the user is holding the device, no animations.
What is happening instead is that if the user holds the phone with the home button on the right, the interface is drawn upside down, and then autorotated to match the device rotation. The phone automatically prefers one landscape mode over the other, and I need it to prefer neither (or at least APPEAR to prefer neither, even if this means the use of trickery is needed.)
This question seems to be asking the same thing, although the use case there is somewhat different, and it's unanswered.
What do I need to do to achieve this?

My IOS orientation acting very strange and won't listen to any programing-code?

As the title describes I am having a big "what the * is this" at my app atm. It seems I can't get the control over the orientation at all in the different slides.
I can only manage the orientation in one way, via the info-plist file. The problem is, info-plist file sets the orientation for the whole app and I am not interested in that.In some slides I want to allow Landscape left/right and others only Portrait and this is not doable vie info-plist?
I have tried my best to understand the problem but I can not say I have gained any bigger "aha moment" so far. I am using UINavigatorbar and Tabbar in my IOS-app which may occur the problem. How can I make the app to start listening to the code in each-file so I can manage the orientation localy ?
Are you using iOS 6? If so, the -shouldAutorotateToInterfaceOrientation method was deprecated.
You now have to override -supportedInterfaceOrientations and -preferredInterfaceOrientationForPresentation methods in order to manage screen orientation. You can do this globally or within individual view controllers.
See the UIViewController class reference for more details.

Resources