我有一个UITableviewController
和一个按钮,点击另一个UIViewController
后会出现
[self presentViewController:newPopupViewController animated:YES completion:nil];
然后,当我点击此UIViewController
(newPopupViewController
)中的关闭按钮时,系统会将其移除,并显示之前的UITableVIewController
。
[self dismissViewControllerAnimated:YES completion:Nil];
当UITableVIewController
出现时,我想重新加载表数据。我怎么能这样做。
答案 0 :(得分:2)
-(void)viewWillAppear:(BOOL)animated {
// Relead data here
}
答案 1 :(得分:2)
你可以使用一个块。假设你有FirstViewController和NewPopupViewController,所以在NewPopupViewController.h文件中写一下,
@property (nonatomic, copy) void(^ReturnBlock)(BOOL);
并在NewPopupViewController.m文件中解除ViewController集,
self.ReturnBlock(YES);
[self dismissViewControllerAnimated:YES completion:nil];
所以在你调用presentViewController写的FirstViewController中,
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
NewPopupViewController *newPopupViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstView"]; // The Identifier should be from the Storyboard
[self presentViewController:newPopupViewController animated:YES completion:nil];
[newPopupViewController setReturnBlock:^(BOOL flag)
{
if (!flag)
{
//reload you table here
}
}];