viewDidAppear for tabbar based apps

戏子无情 提交于 2019-12-10 14:47:24

问题


I'd like to do something when a particular tab appears. Meaning, the user has clicked the tab view's tab button. viewDidAppear doesn't fire when this happens. How else can I hook into the tab click event?


回答1:


You can implement this

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
  [viewController viewDidAppear:YES];
}

in your Tab Bar Delegate, so your viewDidAppear method will be called properly.




回答2:


Implement -tabBarController:didSelectViewController: in your tab bar delegate.



来源:https://stackoverflow.com/questions/2758798/viewdidappear-for-tabbar-based-apps

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