Application tried to present modally an active controller

给你一囗甜甜゛ 提交于 2019-11-29 12:00:48
gregory

I believe the proper way to dismiss a modal view is to use delegation as defined in here.

In practice you define a method on the 'menu view' that will dismiss the active modal view by calling the usual :

- (void) notifytoclose {
    [self dismissModalViewControllerAnimated:YES];
}

You call it from the menu view but it will close the active modal on top of it. Then you define a delegate property on the modal table view controller, set it to the instance of the menu view, and in the method that closes the table view you call :

[delegate notifytoclose];

The use of [self dismissModalViewControllerAnimated:YES] to close the current instance is not always working although the circumstances are not clear to me. I also noticed differences between iPAd and iPhone behaviour.

For my specific needs, the following did the trick for getting back from thetableview:

[self.mapLegendViewController dismissModalViewControllerAnimated:YES];

Gregory's point is noted though, and I recommend reading the link he made as it is interesting as to how iPhone/iPad each handle these actions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!