拦截UIViewController的popViewController事件
实现拦截 UIViewController 的 pop 操作有两种方式: 自定义实现返回按钮,即设置 UIBarButtonItem 来实现自定义的返回操作。 创建 UINavigatonController 的 Category ,来定制 navigationBar: shouldPopItem: 的逻辑。 UIViewController+BackButtonHandler.h: #import <UIKit/UIKit.h> @protocol BackButtonHandlerProtocol <NSObject> @optional // Override this method in UIViewController derived class to handle 'Back' button click -(BOOL)navigationShouldPopOnBackButton; @end @interface UIViewController (BackButtonHandler) <BackButtonHandlerProtocol> @end UIViewController+BackButtonHandler.m: #import "UIViewController+BackButtonHandler.h" @implementation