didSelectViewController does not get called on certain occasions

后端 未结 3 1797
灰色年华
灰色年华 2021-01-21 20:21

I have the problem that many already have reported, didSelectViewController doesn\'t get called, but in my case it sometimes gets called. I have three tabs and thre

3条回答
  •  青春惊慌失措
    2021-01-21 20:32

    I too had this problem and got fed up with it. I decided to subclass UITabBarController and override the following methods. The reason I did both was for some reason on application launch setSelectedViewController: wasn't being called.

    - (void)setSelectedIndex:(NSUInteger)selectedIndex
    {
        [super setSelectedIndex:selectedIndex];
        // my code
    }
    
    - (void)setSelectedViewController:(UIViewController *)selectedViewController
    {
        [super setSelectedViewController:selectedViewController];
        // my code
    }
    

提交回复
热议问题