开发者

where should I pop a UINavigationController?

开发者 https://www.devze.com 2023-03-15 22:14 出处:网络
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 UINavigationControlle

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号