我有一个TableViewController
嵌入在 a 中NavigationController
,在某些时候我使用 a Segue
topush
到一个新的ViewController
. 当我从 导航回来时,我ViewController
想重新加载tableView
.TableViewController
我遵循了此处和此处发布的解决方案。由于某种原因,它不起作用。我想念一些东西,但我现在看不到它。
有没有人有胶水,为什么代码不起作用?我该怎么做才能让它工作?
表视图控制器.m
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// notification when comeing back from the cameraView
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadMagazine:) name:@"reloadTable" object:nil];
}
return self;
}
//[...]
// notification reload
-(void)reloadMagazine:(NSNotification *)notification {
NSLog(@"notification reload");
[self.tableView reloadData];
}
//[...]
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadTable" object:self];
}
视图控制器.m
-(void)uploadData:(id)sender {
// Upload and navigate back to the tableViewController
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadTable" object:self];
[self dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popViewControllerAnimated:YES];
}