Commit 83487e3cef50343b2a3cfa82f0fce3ceeb726ca9
1 parent
a30c0828
no message
Showing
2 changed files
with
10 additions
and
1 deletions
CNLiveBaseClass/Classes/Controller/CNLiveBaseViewController.h
| ... | ... | @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 13 | 13 | @interface CNLiveBaseViewController : UIViewController |
| 14 | 14 | // 是否隐藏导航栏 |
| 15 | 15 | @property (nonatomic, assign) BOOL navigationHidden; |
| 16 | - | |
| 16 | +@property (nonatomic, assign) BOOL interactive; | |
| 17 | 17 | // 子类重写添加子视图方法 |
| 18 | 18 | - (void)createSubViews; |
| 19 | 19 | ... | ... |
CNLiveBaseClass/Classes/Controller/CNLiveBaseViewController.m
| ... | ... | @@ -21,6 +21,15 @@ |
| 21 | 21 | self.navigationController.navigationBarHidden = YES; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | +- (void)viewDidAppear:(BOOL)animated { | |
| 25 | + [super viewDidAppear:animated]; | |
| 26 | + // 禁止页面左侧滑动返回,注意,如果仅仅需要禁止此单个页面返回,还需要在viewWillDisapper下开放侧滑权限 | |
| 27 | + // 禁用返回手势 | |
| 28 | + if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { | |
| 29 | + self.navigationController.interactivePopGestureRecognizer.enabled = self.interactive; | |
| 30 | + } | |
| 31 | +} | |
| 32 | + | |
| 24 | 33 | - (void)viewDidLoad { |
| 25 | 34 | [super viewDidLoad]; |
| 26 | 35 | // Do any additional setup after loading the view. | ... | ... |