I know th开发者_StackOverflowat 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?
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.
精彩评论