Displaying a UIView over the tab bar in a UITabBarController - iphone

I'm using a UITabBarController. Is it possible to display a UIView over the tab bar of the controller?

Use UIViewController with UITabBarControllerDelegate, add a UITabBar to it, set the delegate. You will be able to add UIViews over the view controller.

If you are talking about another view controllers view then present that view controller over the tab bar controller view.For ex. lets say About is the tab inside the ta bar controller.Then when you click on the About tab it will show one view controller which is inside the tab bar controller.In that view controller in view did load you can right the below code to see the view over the tab bar controller.
views=[[AboutUsViewController alloc] initWithNibName:#"AboutUsViewController" bundle:nil];
[self presentModalViewController:views animated:NO];

Related

UIViewController in a UITabBarController without tab bar item

So I have this application where I have a view controller (which I want to appear first when the app starts) and a tab bar controller. I also have other navigation bar controllers that are in the tab bar controller. I want to place my view controller on top of the tab bar controller. Making the tab bar controller the parent of the view controller would be better though.
But take note, I do not want a tab bar item to represent the view controller and I want the tab bar to appear along with the view controller. I do not and would not want to use storyboards as much as possible. How can i achieve this?
I guess the simplest solution would be to use a screenshot of your tabBar and put it in your HomeViewController as a button. In this case you could use your HomeViewController as rootViewController and in the button action you set the TabBarController as the rootViewController.
Root = Home + Button
-->
Root = TabBar
Perhaps you need four buttons, if you want the correct tab to be selected.

How can i dismiss modalViewController without leaving current view?

My application is view based app. First view is login view. After login view i have MainMenuCcontroller which has a tabBarController:
#interface RunnoMainMenuController : UIViewController {
IBOutlet UITabBarController *tabBarController;
}
From login view controller, i am going to MainMenuController using this line of code:
[self presentModalViewController:mainMenu animated:YES];
this controller has 4 tabs. Now i need to do some stuff in viewWillAppear of a tabBarItem. viewWillAppear is not called when i tap a tabBarItem. I have a button in one of those tabBarItem's view which pops up a table view controller using presentModalViewController. This tableView uses dismissModalViewControllerAnimated:YES to disappear it. When i pop up this tableview and dismiss it then viewWillAppear of every tabBarItem works fine. If i will dismiss modalViewController in MainMenuController then it will again go back to login view. How can i dismiss modalViewController without leaving current view or any other solution? Thanks in advance.
You may need to consider how your views are presented. The tab bar controller should always be the window's root view controller. From the Apple docs:
When deploying a tab bar interface, you must install this view as the
root of your window. Unlike other view controllers, a tab bar
interface should never be installed as a child of another view
controller.
Rather than present your login view as the root view and the tab bar as a modal view controller, try it the other way round. The tab bar controller as root, with the login view as presented as a modal view controller from the view controller of whichever tab is shown initially. Dismissing this will then reveal the tab bar controller.

navigation controller doesn't show up iphone

I have an application with a tab bar as the root controller. I have four items in the tabbar. The second item is a table view and this should have a navigation controller of course, the thing is that i don't even get the navigation bar to show up and i have no idea how to do it. So i tried to guess after a long time in google without success. This is what i did in the viewDidLoad method:
SearchNavController *navController = [[SearchNavController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:navController];
[searchNavController release];
With that i got an IlegalArgumentException.
How can i get the navigation bar to show up?
Thanks in advance guys
Have a nice day!
Since you used interface builder to setup your tabbarcontroller. follow the following steps to get navigation bar and navigation controller in your tabbarcontroller:
Open Mainwindow.xib and select tababarcontroller .
In the attribute inspector , select the item1 in viewcontroller and from the arrows to the right change it to navigation controller.
Try this link:
link 1
Your navController should probably an ordinary UIViewController with the view you want to display. Also you need the following to actually display the navigationController:
[self presentModalViewController:navigationController animated:YES];
The navigation controller should now show up with your view as it's content.
IF you are using interface builder. Then Add UINavigation controller in each tab bar then add your view controller in uinavigation conrtroller. If you have 4 tabs then you have to put 4 navigation controller.
UITabbarcontroller ->>Tab Bar >>
UINavigationController >> set its class to your viewcontroller

Tab Bar in View Based Application - XCode

How can I use Tab Bar in my View Based application in second view ?
EDIT :
(Suppose)My application contains four views. The navigation from firstView to secondView is simple , I want the Tab Bar on the secondView and connect rest of the two view with the Tab Bar.
On the other hand I think this has been discussed here: uitabbarcontroller / uitabbar in navigation based project
Just take a look.
EDIT: If it is a navigation based app and you want your tabbar on the second view, just initialize the navigation controller and use pushViewController message to it and push the tabBarController onto the navigation stack.
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1,viewController2,nil];
[self.navigationController pushViewController:tabBarController animated:YES];
Place this wherever you wish to push this tabBarController from the first view, where the first view is a navigation controller based entity and viewController1,viewController2 etc are the view controllers from the tab bar items.

How can I prevent a view from covering my tab controller in my tab based application?

I have an application with a Tab Bar Controller that has three tabs.
In tab 1 there is a view (view1) with a button that when clicked transitions the user to a new view (view2) still within tab 1. However when this new view (view2) is loaded it covers my tab bar controller.
What is the best approach for me to take to still display tab bar controller as well as keep tab 1 highlighted?
How are you performing your "transition" to view2 from view1?
One solution is to use a UINavigationController as the root view controller for tab1, so view1 can display view2 by pushing it on the navigation controller. Alternatively, have view1 display view2 modally.
Either way should not cover your tab bar, and tab1 will still be selected (highlighted).
I think you are pushing the view as modal view if this is the case then the view will definitely cover your tab bar the other way to do this is push the view controller and this will not hide your tab bar.
Try to do it like:
[[self navigationController] pushViewController:viewContObject animated:YES];
Hope this helps,
Thanks,
Madhup