tabBarController unLoad itself after call modalView

时间秒杀一切 提交于 2019-12-02 09:48:12

It looks like You added [self.tabBarController setSelectedIndex:6]; to viewWillAppear instead of viewDidLoad. There is no viewWillLoad there.

Do something like this in the viewDidAppear method of your tab bar controller, so it only sets the selectedIndex when the app starts up:

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    static BOOL isFirst = YES;
    if (isFirst) {
        [self setSelectedIndex:6];
        isFirst = NO;
    }
}

I change order of items in my tabBarController in storyboard, change numbers of views in code and everything works. Thanks to all.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!