tabBarController unLoad itself after call modalView

后端 未结 3 1305
臣服心动
臣服心动 2021-01-29 02:08

I have tabBarController with 6 views. As default tabBarController load first view, I need to load view #6 at my application start, so in my tabBarController I add to viewW

相关标签:
3条回答
  • 2021-01-29 02:37

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

    0 讨论(0)
  • 2021-01-29 02:39

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

    0 讨论(0)
  • 2021-01-29 02:45

    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;
        }
    }
    
    0 讨论(0)
提交回复
热议问题