kannan
kannan

Reputation: 1

UITabbarcontroller switching problem

I have created a tab bar application. In that application, I have three tab bar items. Each tab bar controller has a navigation controller. I have pushed two UIViewController from first tab bar item (using navigationcontroller) that named new UIViewController. Now I want to move from new UIViewController to the third tabbar item.

I'm using the code below:

self.tabbarcontroller.selectedindex = 2;
[self.navigationcontroller poptoviewcontroller:YES];

But it crashes often. What could be the reason?

Upvotes: 0

Views: 274

Answers (1)

Crazy Developer
Crazy Developer

Reputation: 3464

Why do you pop the view controller?

Just make the change in the tabbar controller and use this code to switch between tabs:

self.tabbarcontroller.selectedindex = 2;

Upvotes: 3

Related Questions