iphone navigation controller - transition between portrait and landscape view controllers - iphone

In my iphone app, i've two view controllers. First one is a portrait and second one is landscape.
When app is started, it will show the portrait view. On click of a button in portrait view, the view transitions to landscape view. Here, i'm using navigation controller.
If both the views are portrait, pushing the next view via navigation controller won't be a problem. How can I achieve transition between portrait and landscape views using nav controller.
Note that status bar is visible and nav bar is hidden.

I would suggest you to use the following instead of pushViewController
[self presentModalViewController:aController animated:YES];
This is the only solution i guess. If you are navigating further from the LandScape mode put the aController inside the UINavigationController and Present the NavController the same way as shown above.

Related

Navigation Bar is in Landscape while View is in Portrait

I am trying to set up some views on the storyboard.
Now I am stuck with displaying the navigation bar in the correct way.
When the corresponding view opens (in Portrait mode) the Navigation Bar opens in Landscape Mode.
How can I set the navigationBar to stick with the screen Orientation and Size?
I am unsure what you mean, are you using the simulator or a Device ? Make sure you add constraints to pin the bar to the top of the view controller or embed your view controller in a navigation controller.

View is not rotating

I am making a navigation based app and I need only portrait orientation except in a ZoomPictureViewController ( Zoom in, zoom out images) that supports all orientations.
I am presenting ZoomPictureViewController and returning YES in shouldAutorotateToInterfaceOrientation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
But I get no rotation. I know that shouldAutorotateToInterfaceOrientation, willRotateToInterfaceOrientation, RotateToInterfaceOrientation are only get called on the current/visible view controller but this is not happening in my case. I have checked it via putting breakpoints and NSLog.
Are you using any type of Navigation Controller or a Tab View Controller? I've noticed that there are issues when rotating a UIView that's not the first or only view as a direct child of the main window.
So if your UIView is part of a Navigation Controller or a Tab View Controller, you'll also need to override shouldAutoRotateToInterfaceOrientation on the Navigation Controller or Tab View Controller.
Also I here's an important gotcha in the Apple documentation that might explain the problem you are having.
Tab bar controllers support a portrait
orientation by default and do not
rotate to a landscape orientation
unless all of the root view
controllers support such an
orientation. When a device orientation
change occurs, the tab bar controller
queries its array of view controllers.
If any one of them does not support
the orientation, the tab bar
controller does not change its
orientation.

SplitViewController Portrait PopOver Issue

When I switch my iPAD to portrait mode the navigation bar buttons button appears correctly. Now If i choose a table row from popOver View and push a new screen for the master and detail view the navigation bar button disappears and wont appear until I rotate the device to Landscape and then back to Portrait. Does anyone have a idea how to fix this ?
Perhaps you are not setting the delegate in the UISplitViewController
self.delegate = secondViewController;

Rotate a UIViewController

I have a navigation view controller. When i select a tableview cell it push a new ViewController from UIInterfaceOrientationPortrait state.
Now if i Rotate the new ViewController Landscape mode and pop the new ViewController and go back the table view Navigation Controller main page then i can see that, NavigationController main page is its previous UIInterfaceOrientationPortrait mode and i can't see the downstair part of my tableView interface.
How i am gonna fixed this such a way that if i pop up the newViewController, the Main Navigation ViewController page will view such a way that achieve the Orientation mode of newViewController.
That mean's if the newViewController is in landscape mode than the main page will automatically landscape mode and if the newViewController is in Portrait mode then the main Navigation page will be automatically Portrait mode.
Any solution ????
Add the following in all your view controllers (in the navigation stack) implementation files.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

View controllers inside tab bar controller not auto-resizing on rotation

(Correction: the view controllers are not auto-resizing instead of not auto-rotating.)
In an iPad app, I have five regular view controllers (not navigation controllers or anything like that) inside a tab bar controller. The tab bar controller is just a plain UITabBarController declared in the app delegate.
All the view controllers return YES in the shouldAutorotateToInterfaceOrientation method.
On both the simulator and device, on rotation, the tab bar and the current view controller rotate but the currently selected view controller (call it A) does not resize properly. It keeps its portrait width and height (but it is rotated).
If I switch to another view controller B and then back to A (without rotating the device again), A appears correctly resized.
This happens with any of the five view controllers
Why doesn't the currently selected view controller resize immediately on rotation and how do I fix it?
Thanks.
You should add :
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
To each viewDidLoad method of the sub-viewcontrollers of your tabbar controller.