I want to combine UITableViewController and UITabBarController:
1) UITableViewController with navigation is shown
2) UITabBarController is pushed
([self.navigationController pushViewController:nextController animated:YES];),
the tabbar is shown, navigationItem is invisible, but the navigationBar stays.
Is this possible? Is there an example?
Correct me if I'm wrong, but it sounds like you have a UINavigationController with a UITableViewController pushed onto it and you would like to push a UITabBarController on to the navigation stack as well. If that is the case, then you may want to read Apple's View Controller Programming Guide for iOS where is states the following:
"Although a navigation controller can be embedded inside a tab, the reverse is not true. Presenting a tab bar interface from within a navigation interface is potentially confusing for users."
Having written that, there is a way to do it, but you must use a custom UIViewController instead of a UITabBarController. This is discussed in detail here
Related
I'm creating an app that has a similar layout as the Apple Contacts app. I have created a UITableViewController and embedded it in a UINavigationController using a Storyboard. I then have an add button that opens a UITableViewController in a modal view. I have added a top bar to this view using the storyboard and it works pretty good. The problem is that it scrolls away when you scroll in the table. It should stick to the top.
Do I need to embed this modal UITableViewController in a UINavigationController as well to get the "sticky top bar"?
What's the preferred way of doing this? Just embed using the storyboard or just create one "on the fly" in the prepareForSegue method?
EDIT
I ended up just embedding the modal UITableViewControllers in UINavigationControllers using Storyboard.
Yes, you do need a UINavigationController that contains the UITableViewController to get what you aim for.
Personally, I would prefer creating it "on the fly" as you call it. But that is a matter of taste.
The way to do it in the storyboard is to have your modal view controller be a UIViewController rather than a UITableViewController. Add a view controller, then drag in a tool bar, and position it at the top. Then add a table view to take up the rest of the space below the tool bar. This will work correctly without scrolling with the table view.
I'm making customized UIScrollView such like pinterest's two column view.
The scrollview should have search function. So I tried to use UISearchDisplayController but I can't because UISearchDisplayController implements only UITableView.
So, I created search display controller such like UISearchDisplayController. It's good. well done.
But I have a big problem. I can't implement completely behavior of UISearchDisplayController when go to detail view.
See below images.
this image is UISearchDisplayController's behavior on Simulator's Contact App.
Detail view have a navigationBar when pushed. but first view's navigationBar is hidden.
The UISearchDisplayController's behavior is good to transition view. Search view don't have UINavigationBar and detail view has UINavigationBar separately. but my controller can't do that.
I call setNavigationBarHidden:animated method try to hide navigation bar when touch UISearchBar on search view.
How to implement second image. any ideas?
sorry for my bad english :)
The search bar is different view, so here you need to call the below methods while view is navigating from one view to others.
self.navController.navigationBarHidden = YES;
or
[self.navigationController setNavigationBarHidden:YES animated:animated];
I'm currently creating an ipad application.
the idea is to have a toolbar at the top and a tabbar at the bottom.
The toolbar has to be visible on all tabs, so it won't disappear.
I was thinking about having a UIViewController as the main view and put the tool bar in there.
Then adding the uitabbarcontroller to that main view controller, but i'm not sure how to do that.
At the moment i have my tabbarcontroller as the main view and added the toolbar to every tab.
Can anyone help?
Thanks
The Tab Bar Controller should be at the root. What you can do is create a method that returns a propertly configured toolbar & add it to each of the view controller's viewDidLoad (either by using a category method, inheriting a common UIViewController subclass, or simply via a C-style factory method.
This way your hierarchy isn't flipped, and the tab bar is at the root like it should be.
I have added a UIButton to a toolbar that is only accessible via the RootViewController (which has a navigation bar and toolbar) of my app. When navigating to another view, I hide the UIButton, but when I go back to the initial screen (a map view) the UIButton remains hidden and I must unhide it. Since it is the RootViewController I am doing this in, viewWillAppear is not called, so I cannot use that method.
I am wondering if there is any way the RootViewController knows when a view is being popped off the navigationController stack, if so, how would you suggest I check for this? Is there any way you would recommend implementing this?
Thanks in advance!
if your app using UINavigationController for navigation then viewWillAppear will obviously called
I am trying to create a view with a TableView in the center, NavigationBar on top, and a TabBar with 5 items. The TabBarItems will be attached to 5 different modal views. And the tableview can select an item and "navigate" to another tableview or detail view.
Following the Apple doc, I tried to create a NavigationController in a TabBarController in IB, but failed. I read all the posting regarding to this topic, and they all described a NavigationController inside one of the TabBarItem. But that is not what I want. The TabBarController and NavigationController are separate controller doing separate thing in the same view.
So I start wondering maybe it is a design issue. I should just use a NavigationController and add the TabBar as objects and not controller in the view.
Am I going the right track or is there a better way to combine NavigationController and TabBarController in IB to do the job that I want. Am I making sense?
If the tab bar is actually being used as a tab bar, it sounds like you want 5 navigation controllers, one for each tab.
If the tab bar is being used as a toolbar to hold buttons that bring up modal view controllers, push views onto the navigation controller, or other actions besides what a tab bar is intended for, use a UIToolbar instead. UINavigationController actually has toolbar support built in, just set its toolbarHidden property to NO and set the toolbarItems property on each view controller that can go inside the navigation controller to an array of appropriate UIBarButtonItems.