繁体   English   中英

如何通过iOS Objective C中的appDelegate从另一个视图控制器重新加载表视图

[英]How to reload table view from another view controller via appDelegate in iOS Objective C

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

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

[appDelegate.singleGrid.singleGridTable reloadData]

确保已将singleGrid声明为appdelegate.h中的一个属性,例如

@property (nonatomic, strong) SingleGridViewController * SingleGrid;

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

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

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

更多代码可能会有所帮助(相关的标头和实现),但我可以在黑暗中进行尝试。 firstViewController是否知道SingleGrid上将存在哪些属性? 无论您要访问SingleGrid上的属性如何,都需要包含用于声明该属性存在的标头。 你的firstViewController也是如此

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM