<分区>
标签 iphone ios objective-c
<分区>
我通过这段代码从 View Controller A 转到 B:
[self presentViewController:B animated:YES completion:^{
}];
当 View B 被关闭时如何通知我以及此时我如何将一些参数从 B 回传给 A?
最佳答案
当需要关闭 View Controller B 时,使用以下方法:
// This code goes inside View Controller B. Here "self.presentingViewController"
// refers to View Controller A
[self.presentingViewController dismissViewControllerAnimated:YES completion:^{
//completion code here
}];
// In your View Controller A implement dismissViewControllerAnimated:completion:
// and call super. This code goes in View Controller A
-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
// Here you can add your custom code.
[super dismissViewControllerAnimated:flag completion:completion];
}
这样 View Controller A 就会知道 View Controller B 何时被关闭。
希望这对您有所帮助!
关于iphone - 从 UIViewController A 到 B 并获得反馈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18473242/