4

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

I want to check when aViewController is dismissed.

How can I do that?

Thanks!

1 Answers1

4

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

xeonarno
  • 426
  • 6
  • 17