拿到tabbar 单例,让当前选中变成 要跳转的controller个数
两种方法:
第一种:
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
JLTabBarController *tab = (JLTabBarController *)delegate.window.rootViewController;
tab.selectedIndex = 2;
第二种:
JLTabBarController *tabbar = [[JLTabBarController alloc] init];
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
keyWindow.rootViewController = tabbar;
tabbar.selectedIndex = 2;
网友评论