I know that for a modal view controller the recommended way of dismissing it is using the delegate protocol design-pattern. Does the same apply when popping a UINavigationController?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Bear in mind that the typical way of popping a view in a UINavigationController stack is via the back button in the navigation bar, which the UINavigationController provides for you. There’s no need to code for that.
However, if you’ve got a view which doesn’t display the navigation bar (e.g. it sets
self.navigationController.navigationBarHidden = NO) then yes, you should define a delegate on your UIViewController subclass and make the delegate responsible for dismissing the view.The rationale behind this is the same as for modal view controllers; the view controller shouldn’t have to know about how it was presented.