gpt4 book ai didi

iphone - 从 AppDelegate 调用 RootViewController 上的 [tableView realoadData]?

转载 作者:行者123 更新时间:2023-11-28 23:14:39 24 4
gpt4 key购买 nike

在我的应用程序中,我正在发出 HTTP 请求并等待并使用数据更新我的 RootViewController。问题是,我需要在我的数据收集完成后调用 [tableView reloadData],就目前而言,tableview 将部分填充或根本不填充。我遇到了这个线程:

Passing an NSDictionary to a ViewController from AppDelegate

其中包括用于在应用委托(delegate)的 View Controller 中设置数据的解决方案,但我想知道如何根据我的情况调整它?我认为,我所需要的只是对 appDelegate 中 rootViewController 的引用,这样我就可以在需要时调用 reloadData

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil tableDataSource:(NSArray*)tableData {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
tableDataArray = [tableData retain];

}
return self;
}

感谢任何想法

最佳答案

tableView 声明为该类中的属性,例如 myTableView。现在引用该类并调用 [classObject.myTableView reloadData];

它应该可以工作。

关于iphone - 从 AppDelegate 调用 RootViewController 上的 [tableView realoadData]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6976334/

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