UIBarButtonItem changes the viewController's orientation - ios

I got a UINavigationBar with an .rightBarButtonItem. If I tap on it, it pushes the new viewController and a .leftBarButtonItem is brought up automatically which takes me to the viewController I was before.
The problem is (when I tap on the .leftBarButtonItem) that the orientation is changed from landscape to portrait mode, though I want the app to stay in landscape mode. How can I fix that?
Thanks a lot!

It's not clear if you were in portrait mode before you pressed the right button bar item.
It sounds like the first view controller's shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation isn't returning YES for portrait orientations.

Related

Rotating SplitViewController messes up toolbar in master view

I have a SplitViewController. In the master view I have a toolbar that is attached to the status bar.
When I launch the app in landscape mode (master view is visible), it looks great:
I launch in portrait:
After launching in portrait I rotate the screen to landscape. The master view appears as it should, but the toolbar is no longer attached to the status bar.
As you can see the toolbar is too small now and runs into the status bar. I have the delegate setup correctly to tell the toolbar to attach to the status bar. This problem only seems to happen when I start the device in portrait and rotate it.
I have tried to force the master view to re-layout by calling setNeedsLayout in viewWillAppear but that makes no difference.
Please help!
Just a guess, but make sure that in your view controllers that this is set appropriately:
- (BOOL)prefersStatusBarHidden
{
return NO
}

iOS Keyboard Rotating on a Fixed Landscape Orientation

I'm working on a iOS 6 iPad app. In the Target Summary page I've set the orientation to landscape.
From one screen I have a modal view appearing and when it does the keyboard automaically appears i.e. using becomeFirstResponder in the ViewDidLoad method
However when it appears it animates/rotates from the 'portrait' postion rather than simply appearing from the bottom.
Any ideas on this?
Cheers.
try moving the becomeFirstResponder call out of viewDidLoad and into viewDidAppear

How can i change portrait to landscape and back by pressing a button?

I have an ipad app which i locked to landscape left. However it has an uiwebview which can change to portrait or landscape depending on the content. I want to do that pressing on a button. Is that possible? Thanks in advance!
In general, a UIViewController will allow its UIView to rotate to follow the orientation of the device. If you don't want a rotation to occur, then you would specify your preferred/only orientation using supportedInterfaceOrientations:
So, for your need, when a button is pressed invoke supportedInterfaceOrientations: with the one and only orientation that the UIView should use. After you specified the orientation call attemptRotationToDeviceOrientation to force the transition.

How to prevent iPad Modal that contain UIWebView to rotate to portrait

I have application that is only landscape with no other orentation supported.
But when I open modal view (modal contains UIWebView ([printView setView:webView])) it rotates the device to portrait.
The content stays in landscape view only iPad orientation. I mean the statusbar is rotated like it's in portrait. So I want no rotation at all, just to stay in landscape.
I have solved the problem. Problem was in viewController that was programaticly created.
Solution is to create viewControler and in .m file force landscape orentation.

Same View for landscape and Portrait in Splitview

I want same view in portrait and landscape in splitview in iPad Application. In portrait I get rootviewcontroller as popOver. I don't want that. It should be same as it is displayed in landscape mode. Is it possible?
Well, I'm afraid that the term same is a bit confusing here. There is no problem for you to develop a similar view, but evidently with other size and proportions. You can perfectly dismiss the popover on the portrait mode, and compose your new view with a tableview controller at the left side of the screen.

Resources