gpt4 book ai didi

ios - 如何从 UITabBarViewController 调用 sub-tableVIew 方法

转载 作者:行者123 更新时间:2023-11-29 02:14:34 28 4
gpt4 key购买 nike

- (void)tabBarController:(UITabBarViewController *)tabBarController   didSelectViewController:(UIViewController *)viewController {
NSLog(@"selected %lu",(unsigned long)tabBarController.selectedIndex);
if (tabBarController.selectedIndex == 0) {
//call refresh() in PlayerTableViewController
} else {
// ...
}
}

下面是 UITabBarViewController

在第 4 行中,我想调用一个名为 refresh() 的方法来更新 PlayerTableViewController 中的数据。我该如何实现?谢谢 enter image description here

最佳答案

- (void)tabBarController:(UITabBarViewController *)tabBarController       didSelectViewController:(UIViewController *)viewController {
NSLog(@"selected %lu",(unsigned long)tabBarController.selectedIndex);
if (tabBarController.selectedIndex == 0) {
//call refresh() in PlayerTableViewController
UINavigationController *navController = (UINavigationController *)tabBarController.selectedViewController;
PlayerTableViewController *playerTableVC =(PlayerTableViewController *) [navController.viewControllers firstObject];
[playerTableVC.tableView reloadData];



} else {
// ...
}
}

关于ios - 如何从 UITabBarViewController 调用 sub-tableVIew 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28897071/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com