Objective c 不同的Abbar按钮
我的问题是关于一个超级阿巴斯控制器。 我在Appdelegate中声明了一个UInavigation控制器和一个UITableController。但是根据,我希望在NavigationController更改UIViewController时更改选项卡栏按钮Objective c 不同的Abbar按钮,objective-c,ios,uitabbarcontroller,Objective C,Ios,Uitabbarcontroller,我的问题是关于一个超级阿巴斯控制器。 我在Appdelegate中声明了一个UInavigation控制器和一个UITableController。但是根据,我希望在NavigationController更改UIViewController时更改选项卡栏按钮 SettingsViewController *sett = [[SettingsViewController alloc]init]; self.navigationController = [[UINavigationContro
SettingsViewController *sett = [[SettingsViewController alloc]init];
self.navigationController = [[UINavigationController alloc]init];
[self.navigationController.navigationBar setTranslucent:NO];
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
self.navigationController.viewControllers = [NSArray arrayWithObject:viewController1];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:self.navigationController,sett, nil];
self.window.rootViewController = self.tabBarController;
如何做到这一点?使用UINavigationControllerDelegate
@interface SettingsViewController : UIViewController <UINavigationControllerDelegate>
仍然不工作,按照您所说的做了,并将委托方法放置在SettingsViewController中,但这两个按钮仍然在我的屏幕上,在我的应用程序中的每个地方,TabbarController上都有相同的tabbarItems。@user1113419不工作什么?navigationController didShowViewController方法在显示新控制器时未调用。如果你在这个时候需要做一些事情,你需要用这种方法自己动手做。这两种方法自己都做不了什么。但您可以在它们内部更改选项卡栏按钮,如viewController.tabBarItem.image=[UIImage ImageName:@some_icon.png];
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated