修改指定tabbar的文字title,例如更改第2个tabbaritem的名字。
作者:互联网
dispatch_async(dispatch_get_main_queue(), ^{
MainTabBarController *tabBarController = (MainTabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
MainNavigationController * nav = tabBarController.childViewControllers[2];
for (UIViewController *controller in nav.viewControllers) {
if ([controller isKindOfClass:[LocalcityViewController class]]) {
NSLog(@"MineViewController ------%@", controller);
//直接赋值
controller.tabBarItem.title = @"南宁";
LanmuModel *model = self.ColumnsArray[0];
}
}
NSLog(@"topViewController ======%@", nav.topViewController);
});
标签:MainTabBarController,title,dispatch,tabbaritem,controller,nav,tabbar,tabBarContr 来源: https://www.cnblogs.com/whx060900/p/16594275.html