加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – self.tabBarController.selectedIndex不调用viewDidAp

发布时间:2020-12-14 19:02:14 所属栏目:百科 来源:网络整理
导读:在标签栏视图中,当我调用选项卡加载使用self.tabBarController.selectedIndex时,不会调用viewWillAppear如果我之前到过选项卡,则有一种强制视图重新加载的方法. self.tabBarController.selectedIndex = 3; [self.tabBarController.selectedViewController vi
在标签栏视图中,当我调用选项卡加载使用self.tabBarController.selectedIndex时,不会调用viewWillAppear如果我之前到过选项卡,则有一种强制视图重新加载的方法.

self.tabBarController.selectedIndex = 3;
[self.tabBarController.selectedViewController viewDidAppear:YES];

当我回到那个视图时,我还要感谢转储内存的时候我会改变标签,然后重新加载数据库.

解决方法

你可以实施

– (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

在UITabBarControllerDelegate中(可能是你的app委托).然后在那里你可以在你选择的任何索引的viewController上手动调用你想要的方法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读