Landscape mode for a viewController in a UITabBarController - cocoa-touch

I have some 10 view controllers contained in a TabBarController. We have a requirement wherein one view controller out of these 10 view controllers should always be displayed in landscape mode.
Now, when we override:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
and return YES only for Landscape mode in such view controllers, it has not effect. The view controller appears in Portrait mode only.
Probably this is done for a good reason, since when the user switches to a tab whose view controller should support only landscape mode, the whole screen components (including the tabbar) should be rotated to landscape mode, which looks awkward.
Am I right in assuming the cause?
Also, what would be the best way to tackle this? Provide an intermediate view controller in portrait mode and then push the landscape view controllers through it?
Thanks,
Raj

Related

Force a single viewcontroller in the story board in landscape

My Project have 2 views 1. Mainview controller 2. Settingview Controller .
I want my main view controller to support all orientations but the setting view controller should be in landscape mode irrespective of the device orientation. Right now I am facing issues like
1. Even if the scene is in landscape mode the view appears as portrait
2. (BOOL)shouldAutorotate , (NSUInteger)supportedInterfaceOrientations not getting fired.
Any help is appreciated.

iOS 6 view controller layout doesn't update after orientation change when covered by a modal view controller

I have an iPad app which works great for iOS versions earlier than 6.
My root view controller displays a list, and when you click on any item in the list, the root view controller presents a modal view controller to show the item's details.
The problem is, my root view controller has different layouts in landscape and portrait, when there is no modal view controller present, it updates the layout no problem at all when the orientation changes, but when covered by modal view controller, it doesn't update, and this only happens on iOS 6. So when you click on an item, then the modal view controller comes up covering the entire screen, then you rotate the device, and then dismiss the modal view controller, the root view controller is still in old orientation layout, which is really annoying.
I am well aware of the change that in iOS 6 shouldAutorotateToInterfaceOrientation is deprecated and any view controllers covered by a fullscreen modal view controller won't receive rotation events like they did in iOS earlier than 6. I did what was suggested in this thread: iOS 6 Rotation issue - No rotation from Presented Modal View Controller, which is manually pass rotation events from the modal view controller to the view controller behind it, but the view controller behind it still doesn't update its layout. Any solutions?
Move all your rotation logic to viewDidLayoutSubviews. It's that simple, you will get the same functionality as before. What will happen is, after you dismiss the modal view controller, the presenting view will be layout, and you can then switch to the appropriate layout for the current orientation.

segue from landscape only to portrait only

I have two "pages" in my app. one which should rotate between the 2 landscape modes but not allow portrait mode and the other which should rotate between the 2 portrait modes but not allow landscape mode.
How can one set this up so that the orientations are limited correctly when segueing between the two views?
I will write my own segue if I were you and set the orientation of the destination view in the perform method of your custom UIStoryboardSegue and will also set the orientation i want to allow in the shouldAutorotateToInterfaceOrientationof the destination view controller. You can have a look to this question related to custom segue I asked some time ago to get an idea of how to implement custom segue.

iPad launch in landscape issue

When I'm in landscape mode on iPad and trying to launch app I'm getting strange behavior:
My root view controller view is created with dimensionality equal to 768x1024 whereas it should be 1024x768 (device is in landscape mode). Because of that my view hierarchy is corrupted.
View is created by the system (I'm using nib for interface).
Does it bug in iOS, or, maybe, I'm doing something wrong?
Edit: Autoresizing mask is default (everything resizes).
Found a solution here Reporting incorrect bounds in landscape Mode.
I was checking view controller view size in viewDidLoad, while correct sizes available only in viewDidAppear.
That is ok. It is always creates views in portrait orientation when perform rotation to lanscape. So U should implement
- (BOOL) shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)
And check in code

iPad Split View Master not in split mode but as popup

In principle I want to implement a split view.
But I need the master to pop up not only in portrait orientation but in landscape orientation as well. Consequentally I do not want the view to be split at all in landscape orientation.
What is a proper way to implement that?
Is is smart using a split view at all or would you guys suggest an alternative approach?
You can do this in iOS 5 using the UISplitViewControllerDelegate method splitViewController:shouldHideViewController:inOrientation:.
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return (vc == myMasterViewController);
}
If you need to support iOS 4 then you will need to create a custom split view controller or use something like MGSplitViewController.
However, I would only do this if you are going to in fact show two view controllers split on the screen at once. This, really, is the main purpose of a split view controller. It sounds like you might not really need a split view controller, so I would consider just handling the popover yourself by presenting a UIPopoverController of your master view controller from a button on your navigation bar. Then you can just use a standard UINavigationController as your root view controller.
MGSplitViewController will allow you to do this:
https://github.com/mattgemmell/MGSplitViewController