我正在使用iPad的Master-Detail模板。我有一个视图控制器,我想模态显示,所以我用这个代码在关闭ipad中的ModalView后调用MasterView中的函数
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
m_ViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
m_ViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[appDelegate.splitViewController presentModalViewController:m_ViewController animated:YES];
能正常工作和视图控制器有模式加载,现在我试图关闭此视图控制器,所以里面ViewController.m,我叫这行代码
[self dismissModalViewControllerAnimated:YES];
此代码也能正常工作和视图控制器被驳回,但驳回后,我想调用一个函数在我马西德威。怎么做?
根据与Moxy的讨论添加的代码。
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.testViewController testfunction:testImage];
你必须使用NSNotification或创建马西德威的代表和来自调用它这里。 – Amit 2013-05-07 07:08:38
如果我不创建它,它将不会被调用,但我想知道,为什么它没有调用MasterView的VieWillAppear? – Ranjit 2013-05-07 07:10:39
你可以使用委托模式 – tkanzakic 2013-05-07 07:10:57