我的问题是关于UITabbarcontroller。 我在我的Appdelegate中声明了一个UInavigation控制器和一个UITabbarcontroller。但是我希望我的tabbar按钮改变了当我的UIViewController由NavigationController改变时。
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;
如何做到这一点?
答案 0 :(得分:0)
使用UINavigationControllerDelegate
@interface SettingsViewController : UIViewController <UINavigationControllerDelegate>
<。>文件中的
然后
.m文件中的 self.navigationController.delegate = self;
您可以使用方法检测NavigationController中的更改
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated