UISplitViewController transition from top to bottom instead of right to left - iphone

I have a root UISplitViewController that contains a UINavigationController related with a DetailViewController. The DetailViewController calls, via a storyboard push segue, another ViewController, called SecondViewController. When the user clicks on the Back button in SecondViewController toolbar, all the UISplitViewController has a transition from top to bottom, instead of a right-to-left transition of the DetailViewController. In the xCode designed all the transition style properties are set as "Flip horizontal". Is there a way to solve it?

I had the same problem in ios 5, landscape orientation.
Adding shouldAutorotateToInterfaceOrientation: both in Master & Detail controller solved problem
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

Related

Tab bar gets covered by the new view

I have built an app based on a tab bar controller. While I am on one of the tab views I want to be able to swipe my finger and switch to another tab view of which the index on the tabBarController in unknown. I am therefore calling the desired viewcontroller from its nib. The view gets swapped correctly but the problem is that it appears ABOVE the tab bar itself, covering it completely and making it become unusable! How can I push the view back or the tab bar up? Thanks
- (IBAction)swipeLeftDetected:(UIGestureRecognizer *)sender
{
DesiredViewController *controllerInstance =[[DesiredViewController alloc]initWithNibName:#"DesiredViewController" bundle:nil];
controllerInstance.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controllerInstance animated:YES];
}
presentModalViewController:animated always uses whole screen: On iPhone and iPod touch devices, the view of modalViewController is always presented full screen. On iPad, the presentation depends on the value in the modalPresentationStyle property.
If you really use UITabBarController, it instantiates view controllers of its tabs. So trying to instantiate view controller of one of tabs manually is wrong. You will end in a mess of view controllers instances.
Set property selectedIndex of your UITabBarController to switch tab. I think you need this. But it will be switched without animation.
If you know only pointer of controller you want to switch to, ask viewControllers property about controller's index and than switch tab by its index:
self.selectedIndex = [[self viewControllers] indexOfObject:viewController];

Push UIViewController to UITabBarController

I have UITabBarController, which has four tabs. When moving from another UIViewController to one of the view in UITabBarController, bottom Tab Bar item is not appearing and also there is space at the top and bottom of the screen. How can I avoid that. I am using storyboard.
Here is the code I am using, while moving from UIViewController to UITabBarController:
HomePage *mvc=[self.storyboard instantiateViewControllerWithIdentifier:#"HomePage"];
[self presentViewController:mvc animated:YES completion:nil];
mvc.hidesBottomBarWhenPushed = NO;
Hmm, if you're moving to a UIViewController in UITabBarController it will be messed up. What you need to do is move to the UITabBarController and set it with the correct UIViewControllers with setViewControllers:animated:
So set a segue to the UITabBarController and use setViewControllers:animated: and put your UIViewController in the array as parameter to setViewControllers:animated:.
Is the space the only problem that you have?
1.) Make sure that the UIViewController in storyboard/ib has the same imitated UIItems (Bottom Bar, Navigation Bar, Status Bar) that are displayed on runtime.
Doing so you can fully utilize the available space. Plus the associated view will have the correct size.
2.) Have an eye on the autolayout option and settings. Depending on what you do in detail you can end up with what you describe or with a view that smoothly fits into a larger or smaller superview - as far as possible.

pushviewcontroller iPhone sdk - changing views UITabBar

I have a uitabbar application, and I would like to hide the UITabbar whenever a viewcontroller slides in (it is a tableview so whenever a row is tapped).
I would like the tab bar to hide whenever a viewcontroller is pushed and would like the entire screen to be covered with this new view like in iPod application of iPhone.
Just set the UIViewController hidesBottomBarWhenPushed proprety to YES before you push the viewcontroller.
viewController.hidesBottomBarWhenPushed = YES;

Problems with Interface Orientation and UITabBarController

Quick problem:
I have an UITabBarController with 2 navigation controllers [lets call them Left and Right Controller]
On the default selected Left Controller I can push a new View Controller that detects interface orientation.
On the Right Controller I can push the same View Controller but it won't detect interface orientation, or for that matter, It won't even go into the shouldAutoRotateInterface method at all T___T
Haaalp!!
If it is of any relevance, the View Contoller that I'm pushing use the hidesBottomBarWhenPushed property.
Most likely this is your problem:
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.
The solution is to override the following method on every view controller leading to your view:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
return YES;
}
For example, instead using the default UITabBarController in IB, replace it with your own subclass containing just the method above.
I'm a bit late to the party on this, but I ran into a problem with autorotation at startup for a tab bar app I wanted always to run in portrait.
The app's plist has the necessary settings to both start in and only allow portrait mode, and all my view controllers only allow portrait mode. Yet, when I started the app holding my iPhone in landscape, the app started in portrait, but then rotated to landscape!
Rather than subclass UITabBarController, I simply overrode UITabBarController's shouldAutorotateToInterfaceOrientation: method using a category on class UITabBarController. I included this code in my app delegate:
#implementation UITabBarController(UITabBarControllerCategory)
-(BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
Works beautifully, and is quite lightweight.
does your uitabbarcontroller implement the auto rotate? any child viewcontroller that wants to implement autorotate has to have its parent implement autorotate.

Show/Hide TabBarController in iphone

i am making an application in iphone in which i have 4 tabbars & in one of its tab i have 4 views in 2nd view it needs to hide the tab bar. I am able to hide the tab bar using the setHidesBottomBarWhenPushed:YES in in the initWithNib method of the Viewcontroller being pushed. But when navigating to the screen 3 , calling the same method with "NO" does not make the tab bar appear. any ideas?
John Smith is correct. The URL for that sample is: http://developer.apple.com/iphone/library/samplecode/TheElements/index.html
The code that does this is in AtomicElementViewController.m, and the line that achieves this effect is in the init method:
self.hidesBottomBarWhenPushed = YES;
I had the same issue to show or hide tab bar controller with UITableViewController customized class. Somehow, by using the following codes, does not work to hide tab bar controller:
- (void) viewDidLoad {
self.hidesBottomBarWhenPushed = YES;
}
In the case of storyboard with segue, initWithStyle: method does not get called.
Instead, I have to overwrite the property to make it work:
- (BOOL) hidesBottomBarWhenPushed {
return YES;
}
My case is for iOS 5.1 with storyboard and segue to push to the next view (where I want to hide tab bar controller).
Take a look at Apple's Elements projects. They hide and unhide the tab-bar when you view and individual element.
Before you push your 3rd view onto the stack, set the 2nd view's hidesBottomBarWhenPushed to NO.