#import "HZSHookVCBack.h"
- (BOOL)hzs_backGestureAction {
NSLog(@"點擊了返回按鈕");
[self showAlert];
return NO;
}
- (BOOL)hzs_backBarButtonItemDidClickAction {
NSLog(@"觸發(fā)了返回手勢");
[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