I created a tab bar application with storyboards.
Regardless of which tab is selected, I want to activate a specific tab when an event occurs (such as an error).
I have tried the following example but with no success:
[self.tabBarController setSelectedIndex:0];
Is there another way to manage that?
Related
So, I am still in a learning phase of iOS programming using Swift and got stuck in one issue.
I have a Tab bar controller with options in the tab bar at the bottom.
In one of the tab pages, I have table cells, on click of each, I move the user to a WebView (Embedded in a UIViewController).
On the webView I have placed a back button, which is linked to the main Tab Bar Controller through a segue.
I am able to come back to tab bar controller successfully, but after coming back the tab bar at the bottom does not show.
Also, how can I remove the "
I have attached the main.storyboard screenshot for reference.Main Storyboard flow
I got it working by using the Segue type as "Show Detail" instead of just "Show".
I'm currently making an app which has 4 pages accessible via a tab bar, no problems there. However I have a button on one of the viewcontrollers (lets say A) that opens up another viewcontroller (B). B opens fine, the problem I have now is that the tab bar disappears as it isn't linked to the tab bar controller. Also creating a back button on B to A hasn't helped as the tab bar has gone from A where it usually is.
How would I get the tab bar to show on every viewcontroller I create without there needing to be an icon for every viewcontroller?
My app is based around a UINavigationController. On some screens I have a UITabBarController embedded within. When I go to a screen with the tab bar everything works fine on the first tab. (each tab is a UITableViewController) I can tap a cell of the table view and it'll take me to the next page by correctly pushing it onto my nav controller. If I go to another tab it loads the table view fine, but if I tap a cell to take me to another view I get this error:
Nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
It pushes on the next page, but then if I attempt to press the back button on the nav bar the app will crash.
How could I go about fixing this? I looked at multiple other responses to similar problems, but none of them have helped me with this.
It would be really helpful if you share your code.
However this may be helpful for you:
while using tab bar , you should try that every single tab has its own navigation controller and use individual navigation controller to move to specific viewcontrller of specific tab. I know its hard to understand like this..
For e.g in app del you have your main navigation controller using which you push to next view controller ,say "SecondViewController".
Now this second one has got one tab bar with 4 tabs tab1,tab2,tab3,tab4. now each tab can have any no of view controllers associated with them. For e.g on tab1,you move to another screen and again from there to next screen and so on.
So to manage them there should be separate navigation controllers like,tab1nav,tab2nav,tab3nav,tab4nav.
tabBarController.viewControllers = [NSArray arrayWithObjects:"tab1nav".....and so on all nav, nil];
Now depending in which tab you are, use that tab's navigation controller to move to next screen of that tab or move back.
If you have viewDidAppear function,
Remember to put [super viewDidAppear:animated]; inside the function.
I need to develop tab bar similar to Chrome's tab bar functionality on iPad. If the user opens more then 5 tabs it displays the extra tabs as a stack:
stacked tabs http://uploads.hipchat.com/26718/169836/yfzwdgq80m4rzbw/Screen%20Shot%202013-04-10%20at%202.36.56%20PM.png
How can I achieve this?
There's nothing like that built into iOS, so you're going to have to implement it yourself. I'd suggest implementing the tab bar portion of the window as a separate view that knows how to draw the individual tabs, including the currently selected tab, and which sends an appropriate message to it's target or delegate object when one of the tabs is tapped.
You can build a UINavigationController like Controller, with its own stack. If you are targeting iOS 5.0 and above you can use childViewController. The controller will have a tab bar, and container view. You will add view controllers to the stack of the Controller. From the stack you can form the tab bar item View, using titles of respective vc and views can overlap.
When they are selected bring the tab bar item view to the front and add the respective viewController as childViewController to the CustomTabBarController.
need some help here
My problem is, my app starts with a single view, it shows a menu made with buttons that takes me to different places, one of this places is another kind of menu, but this menu is a tab bar menu, so the thing is, I made a new file with its .xib, I added the tab bar controller, and i Linked all the sections of my tabs with its viewcontrollers...
this means that I have my first menu ready, I have my view controllers ready, I have my menu on the tab bar ready....
so my problem is...
how can I go from my single view (the first view that I see and that doesnt include a tab bar), to the new screen with tab bar controller in it after pressing a button???
help me please
Note: I'm using XCode 4.2 and I'm not working with storyboards (requirements of the app)
You have three options to show your viewController content :
1.using presentModalViewController:
2.add the viewController view as a subView to the current viewController. in your case : [singleViewController.view addSubView:tabBarViewController.view];
3.or if your simple ViewController is the navigation root viewController you can push other viewControllers to its navigation stack. (as #roronoa zorro described).
You might have added all the next viewControllers on the taBarController so if you have want to tabbar on to next screen you simplr have to push the tabbarcontroller on the navigationcontroller.
[self.navigationController pushViewController:TabBarControllerObj];