How can I check if the UIViewController was “Did Dismiss”?

I would like to know, I have a UIButton in class A that does presentModalViewController:aViewController...

I want to check when aViewController is rejected.

How can i do this?

Thanks!

+4
source share
1 answer

Actually you cannot. no notice (apple not working well).

But there is a solution:

use viewDidAppear, viewWillAppear, viewWillDesappear, viewDidDesappear family in the viewController that called the presentModalViewController function

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 ^^

+4
source

All Articles