Tab bar, reload every time tab is pressed

前端 未结 7 679
梦毁少年i
梦毁少年i 2021-01-13 01:17

I am creating an app in which I have five tabs. I need to reload each controller every time when tab is pressed.

相关标签:
7条回答
  • 2021-01-13 02:06
     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {
        //other codes
    
        [self.tabBarController setDelegate:self]
    
        //other codes
        }
    
    // UITabBarControllerDelegate method.
    - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
    {
        if ([viewController respondsToSelector:@selector(reloadDataTemp)]) {
            [(YourViewController *)viewController reloadData];
        }
    }
    
    0 讨论(0)
提交回复
热议问题