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;
Related
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);
}
I have a fairly complicated issue which I will describe as good as possible.
I have an iPad App and a SplitviewController as my main view. In Portrait mode, the SplitviewController hides the Tableview to the left, so that the DetailviewController is visible only. So far so good.
The way you use this, is, from what I understand, that if I tap on a cell to the left, I replace the Detailview to the right with a new view I want to show. To this end, I use the viewControllers property.
Now to display the Popover I have a Toolbar at the top and a Menu Button to display the Popover.
Here's the thing:
I tap on a cell, and replace the DetailviewController with a new Viewcontroller. But now the Popovercontroller is gone, since it was declared in the header of the old ViewController.
The problem: When I tap on the Menu Button in port mode, the popover cant be displayed, since it is nil now, as it wasnt initiated yet.
But what I can do is: I rotate the iPad to the landscape, and rotate it back again. The popover is back, bacause in the delegate method of the splitviewcontroller the following happens:
- (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
self.popoverController = pc;
}
Where does this pc come from? How can I do that myself.
If I try to re-alloc the Popovercontroller this breaks the SplitviewController and artifacts in the App appear.
I hope I explained my problem well enough.
Any ideas?
Take a look at this sample code from Apple:
http://developer.apple.com/library/ios/samplecode/MultipleDetailViews/Introduction/Intro.html
It demonstrates how to switch between different detail views by tapping on items in the table in the split view app's lefthand view.
I am using UINavigationController to push and pop other UIViewControllers in my app.
In one of the UIViewControllers I am using UITabBar to switch between different views. One of the view has UITableView and I am having difficulty showing the tabBar at the bottom. Even if it shows up it scrolls up and down with the tableCells.
I didn't use the tabbarcontroller because apple documentation recommends not to push tabbarcontroller on to navigationcontroller stack.
Thank you.
I guess that you are using UITableViewController. The View of the UITableViewController is the tableView itself, so when you add the tab bar to the view you actually add it to the table view. that is why it scrolls with it.
you should create a regular UIView, and then add the tableView and the tab bar to that view.
shani
I have a small multiview app. It consists of a UITabBarController with a nav controller in each tab. What I want is to show a UIImageView when a user shakes the device. After I've implemented the loading of the UIImageView, I faced a problem-the image was only 2/3 of the screen because of the tab and nav bars. I managed to hide the nav bar but I'm still stuck with the tab bar. I tried many solutions such as [tabBar setHidden: YES]; but I get errors "tabBar undeclared", although I've imported the AppDelegate, where the tabBar was defined.
Thanks in advance!
Try setting
myViewController.hidesBottomBarWhenPushed = YES;
when you create your UIImageView. When you push it on to the view stack the UITabBar will hide automatically, and it will be restored automatically when you pop or dismiss the controller. No need for the application delegate.
If you want to show a full screen view, it is best to use a modal view controller. This way you do have to worry about hiding/showing navigation items. Take a look at:
http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html
to get started.
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.