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?
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;
精彩评论