I have a UITableviewController
and a button where upon click another UIViewController
will appear
[self presentViewController:newPopupViewController animated:YES completion:nil];
Then, when i click the close button in this UIViewController
( newPopupViewController
) will be removed and the UITableVIewController
that was there before will be displayed.
[self dismissViewControllerAnimated:YES completion:Nil];
When the UITableVIewController
appears i want to reload the table Data. How can i do this.
-(void)viewWillAppear:(BOOL)animated {
// Relead data here
}
You can use a block. Suppose you have FirstViewController and NewPopupViewController, so in the NewPopupViewController.h file write,
@property (nonatomic, copy) void(^ReturnBlock)(BOOL);
and in the NewPopupViewController.m file where you dismiss the ViewController set,
self.ReturnBlock(YES);
[self dismissViewControllerAnimated:YES completion:nil];
So in the FirstViewController where you call the presentViewController write,
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
}
}];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.