#import "HZSHookVCBack.h"
- (BOOL)hzs_backGestureAction {
NSLog(@"点击了返回按钮");
[self showAlert];
return NO;
}
- (BOOL)hzs_backBarButtonItemDidClickAction {
NSLog(@"触发了返回手势");
[self showAlert];
return NO;
}
- (void)showAlert {
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否要退出页面" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"确定退出" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self.navigationController popViewControllerAnimated:YES];
}]];
[self presentViewController:alert animated:YES completion:nil];
}
image.png
网友评论