Dismissing modal Views

Discussion in 'iOS Programming' started by mathieuhendey, Dec 30, 2011.

  1. mathieuhendey macrumors newbie

    Dec 27, 2011
    Am I okay to just call [self dismissModalViewControllerAnimated:YES] from the modal view controller or do I have to do it from the parent controller? It works from the modal view, but I've seen some sources state that delegating to the parent is better. Is my app going to get rejected if I don't delegate?
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Shouldn't be a problem. I do it all the time. Apple won't reject the app for this. And, according to the UIViewController Class Reference discussion for dismissModalViewControllerAnimated:
  3. mathieuhendey thread starter macrumors newbie

    Dec 27, 2011
    Great, thanks.
  4. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    The object that was responsible for presenting your modal controller should be the same object responsible for dismissing your modal controller. It will be a cleaner approach. It will help abstract the design of your view controller.

Share This Page