I would like to know, I have an UIButton in class A t开发者_如何学JAVAhat does
presentModalViewController:aViewController...
I want to check when aViewController is dismissed.
How can I do that?
Thanks!
In fact, you can't. there is no Notification (Bad Work apple).
But there is a solution :
use the viewDidAppear, viewWillAppear, viewWillDesappear, viewDidDesappear family in the viewController that called the presentModalViewController function
the idea :
.h :
BOOL hasModal;
.m :
-(void)presentModal
{
hasModal = YES;
[self presentModalViewController:_viewController animated:YES];
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if(hasModal)
{
// your code
}
}
Good luck ^^
精彩评论