gpt4 book ai didi

ios - 如何通过 iOS Objective C 中的 appDelegate 从另一个 View Controller 重新加载 TableView

转载 作者:行者123 更新时间:2023-11-29 01:14:42 24 4
gpt4 key购买 nike

我正在尝试从我的 FirstViewController 重新加载 SingleGrid 的 UITableViewUITableView 的声明是 IBOutlet 和在我的 AppDelegate 中声明的 singleGrid 变量。我想从 FirstViewController 重新加载 singleGrid 的 UITableView。Table View 名称 singleGridTable 不在点之后。

appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

[appDelegate.singleGrid.singleGridTable reloadData]

最佳答案

确保您已在 appdelegate.h 中将 singleGrid 声明为属性,例如

@property (nonatomic, strong) SingleGridViewController * SingleGrid;

那些在 .h 文件中声明的属性是公共(public)的,否则它们是私有(private)的,您不能在其他类中访问它们。

还要确保在 .h 文件中也将 singleGridTable 声明为属性。

@property (nonatomic, weak) IBOutlet UITableView * singleGridTable;

关于ios - 如何通过 iOS Objective C 中的 appDelegate 从另一个 View Controller 重新加载 TableView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35344455/

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