我有一个UINavigationController用户可以返回/第四。当用户返回时,我希望该UIView重新加载。 (我实际上使用的是OHGridView)。在我ViewWillDisappear
,我做这样的事情:如何重新加载UIView?
- (void)viewWillDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] postNotificationName:@"ReloadOHGridView" object:self];
}
所以当他们回去,它会NSNotification发送到OHGridView刷新它的数据。它得到的调用,但它得到的错误Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController reloadData]: unrecognized selector sent to instance 0x4b9e9f0
以下是我建立了我的NSNotificationCenter(在我DetailViewController):
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ReloadGridNotification:) name:@"ReloadOHGridView" object:nil];
}
- (void)ReloadGridNotification:(NSNotification *)notification{
[database executeNonQuery:@"DELETE * FROM images"];
[items removeAllObjects];
[self reloadData];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
现在,你可能会认为这将更新,但我得到这个错误...请帮忙!
库尔顿
谢谢!我创建了一个IBOulet,像这样:'IBOutlet OHGridView * ohGridView;'并调用像这样的刷新:'[ohGridView reloadData]'...只要告诉任何人都有同样的问题! – iosfreak 2011-04-13 01:18:01
甜!祝你好运。 – CharlieMezak 2011-04-13 01:27:53