ユーザーが前後に移動できる UINavigationController があります。ユーザーが戻ったら、その UIView をリロードします。(私は実際にOHGridViewを使用しています)。私のViewWillDisappear
では、次のようなことを行います。
- (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];
}
更新されると思うかもしれませんが、そのエラーが発生します...助けてください!
コールトン