Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

UIViewController-BackButtonHandler

拦截UIViewController的popViewController事件

实现拦截UIViewControllerpop操作有两种方式:

  • 自定义实现返回按钮,即设置UIBarButtonItem来实现自定义的返回操作。
  • 创建UINavigatonControllerCategory,来定制navigationBar: shouldPopItem:的逻辑。

使用

  • 在UIViewController当中引入头文件
#import "UIViewController+BackButtonHandler.h"
  • 在UIViewController中实现navigationShouldPopOnBackButton方法。
- (BOOL)navigationShouldPopOnBackButton{
    [[[UIAlertView alloc] initWithTitle:@"提示" message:@"确定返回上一界面?"
                               delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil] show];
    //renturn no 拦截pop事件
    return NO;
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages