Best form of release a view controller

Discussion in 'iOS Programming' started by jorgmart, Mar 5, 2009.

  1. jorgmart macrumors newbie

    Feb 25, 2009
    This is a simple question (iPhone newbie). Suppose you have 2 view controllers, no navigation controller involved.

    From the first controller, you need to display the second one, then you create (alloc) an instance of the second view controller and add it to the window view.

    My doubt is, when you finish with the second view controller (maybe you pressed a "back" button to return to the first one), where you must release object instance?? ...

    I think there are several options, maybe simply a reference to second view controller saved in the first one. Another option could be to send a notification when the 2nd view controller is closed.

    I'm programming my first app and i would like to do things as best as possible. What do you advice me?

    (My english is not fluent (as you can see), so I hope you can understand me)


Share This Page