uitabbarController的标签叠加在一起过一会才会恢复正常

跳转到uitabbarController时出现了下面的BUG




我的部分代码如下:

    equipmentViewController * equip=[[equipmentViewController alloc]init];

    myNavigationController *nav3=[self NavigationControllerWithviewController:equip title:@"服务" image:@"fuwu@2x" selectedImage:@"fuwuselected@2x"];

    settingViewController * set=[[settingViewController alloc]init];

    myNavigationController *nav4=[self NavigationControllerWithviewController:set title:@"设置" image:@"shezhi@2x" selectedImage:@"shezhiselected@2x"];

    self.viewControllers=@[nav,nav1,nav2,nav3,nav4];



后来经过测试,把uitabbarController添加子视图的方法由self.viewControllers=@[nav,nav1,nav2,nav3,nav4];改成 [self addChildViewController:nav];(剩下的我就不一一写出来了)就好了。

    equipmentViewController * equip=[[equipmentViewController alloc]init];

    myNavigationController *nav3=[self NavigationControllerWithviewController:equip title:@"服务" image:@"fuwu@2x" selectedImage:@"fuwuselected@2x"];

    settingViewController * set=[[settingViewController alloc]init];

    myNavigationController *nav4=[self NavigationControllerWithviewController:set title:@"设置" image:@"shezhi@2x" selectedImage:@"shezhiselected@2x"];

//    self.viewControllers=@[nav,nav1,nav2,nav3,nav4];

    [self addChildViewController:nav];

    [self addChildViewController:nav1];

    [self addChildViewController:nav2];

    [self addChildViewController:nav3];

    [self addChildViewController:nav4];





发布了69 篇原创文章 · 获赞 19 · 访问量 26万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章