SeanF
SeanF

Reputation: 41

How can I create a back button on a Tab Bar Controller view?

I wonder if someone could help me please? I'm brand new to iOS and whilst I've been searching various sites for my answer, I'm afraid I haven't come across it yet but feel this could just be my naivety to the language so I apologise if this is a really simple thing...

I have a Tab Bar Controller with 3 views. On my first tab I have a button which when clicked, I want it to go to the 3rd tab (which is does). However, on the 3rd tab, I would like to insert a back button so that the user has the option of clicking back to go back to what is essentially the main menu of my application.

Can anyone tell me how I can do this please? I'm currently using storyboarding as I'm not very good with the language yet but any help would be greatly appreciated.

Thanks Sean

Upvotes: 1

Views: 2105

Answers (2)

Trung Phan
Trung Phan

Reputation: 923

The first thing, you are implementing UITabBarController. you don't have to create a back button, because user can navigate between screens by tap on tab bar. Second thing, you can use UINavigationController to manage you viewControllers,the Back button will automatically show when you push ViewController by method pushViewController:animated:

Upvotes: 1

Dan
Dan

Reputation: 1447

You need to add a navigation bar to the view and set a bar button item with the action to change the tab.

Remember that a tab controller is standard across multiple apps, the user is use to tapping the tab to change the view rather than pressing buttons within the view.

It might be worth you looking into a UINavigationController

Upvotes: 2

Related Questions