IOS 隐藏导航栏之后 左边框 右划返回

思路: 新建一个BaseVC, BaseVC里实现右划事件的代理, 所有的VC都继承于这个BaseVC.

.h

#import 

NS_ASSUME_NONNULL_BEGIN

@interface BaseViewController : UIViewController

@end

NS_ASSUME_NONNULL_END

.m

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
}

@end

self.navigationController.interactivePopGestureRecognizer.delegate = self;

也可以写成

self.navigationController.interactivePopGestureRecognizer.delegate = nil; 

上面的UIGestureRecognizerDelegate就可以不引入了.

你可能感兴趣的:(ios,导航栏,UINavigation)