Nisar Ahmad
Nisar Ahmad

Reputation: 937

Custom Tab Bar using storyboard

Hello am experienced iOS Developer but new to storyboard, so am using custom tab bar in storyboard using custom segue which works fine (i can do successful switch to the desired tab). But when i wan to add more controllers to the selected Tab using "show" or "push" segue my app crash. I googled many hours but did not find any solution. Any one help me how to resolve this issue .enter image description here

From the above image the Main Report VC is the Tab Controller which i added via custom segue now i wan to push the right one controller colored red to the tab controller, but it crash my app.

Upvotes: 0

Views: 907

Answers (2)

aironik
aironik

Reputation: 105

Push segue works with UINavigationController. So you have to add it.

If you use different segue for single source button you have to define it with -performSegueWithIdentifier:sender: or use different buttons. Each tab in tabbar can manage own navigationController. So you can select necessary navigation controller and perform segue (or push) on it.

MyNavigationController *navigationController = self.navigationControllers[currentTabIdx];
[navigationController performSegueWithIdentifier:@"push" sender:self];

Upvotes: 0

NKorotkov
NKorotkov

Reputation: 3681

Have a look at this implementation. I have a custom tab bar controller in my app and I made one based on this solution. It's really easy to understand and uses storyboards as well.

I did not make it. Credit goes to mhaddl.

You should not use push segues with tab bar controller, they are meant to be used with navigation controller instead.

If you want any help with the error that leads to crash please provide us some crash log info.

Upvotes: 1

Related Questions