开发者

How can I check if UIViewController "Did Dismiss"?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜