开发者

Removing a second viewcontroller's view after dissmissing mail controller

开发者 https://www.devze.com 2023-02-28 08:40 出处:网络
A second viewcontroller has mailcontroller and after finishing mail, it post a message to the mainviewcontroller to remove the secondviewcontroller\'s view. but it\'s not happening. The mailcontroller

A second viewcontroller has mailcontroller and after finishing mail, it post a message to the mainviewcontroller to remove the secondviewcontroller's view. but it's not happening. The mailcontroller appearing and disappearing seem to interferes with finish function of the mainviewcontroller.

secondviewcontr开发者_如何学Gooller:

[self dismissModalViewControllerAnimated:YES];

[[NSNotificationCenter defaultCenter] postNotificationName:@"finish" object:nil];

mainviewcontroller:

-(void) finish:(NSNotification *)notif {

    [MyviewController.view removeFromSuperview];

}


The removal of the second view controller should be delayed until your modal controller is really removed. What I have done is following:

  [self dismissModalViewControllerAnimated:YES];
  m_shouldHide = YES;

And then:

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  if ( m_shouldHide )
  {
    [self dismissModalViewControllerAnimated:YES];
    m_shouldHide = NO;
  }
}
0

精彩评论

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