@来自帖子:在第三个控制器中的过程之后,它再次启动第二个控制器以调用第二个控制器中的方法。
这表明您正在启动 secondViewController 的新实例,其中没有显示 modalViewController。您应该为实际呈现它的实例调用dismissModalViewControllerAnimated。
像下面
像这样设计你的thirdViewController
@class SecondView;
@interface ThirdView : UIViewController {
SecondView *secondViewRefPointer;
}
@property (nonatomic, retain) SecondView * secondViewRefPointer;
@end
和
//While adding the third view from the secondView
ThirdView *thirdViewInstance = [[ThirdView alloc]init];
thirdViewInstance.secondViewRefPointer = self; //self will refer to the current secondView instance
…</p>
在第三个视图中调用dismissModalViewController,如下所示
[secondViewRefPointer dismissModalViewControllerAnimated:YES];