开发者

How can I check if UIViewController "Did Dismiss"?

开发者 https://www.devze.com 2023-01-10 13:13 出处:网络
I would like to know, I have an UIButton in class A t开发者_如何学JAVAhat does presentModalViewController:aViewController...

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

0

精彩评论

暂无评论...
验证码 换一张
取 消