-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
177 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SGPagingViewPopGestureVC.h | ||
// SGPagingViewExample | ||
// | ||
// Created by kingsic on 2018/9/1. | ||
// Copyright © 2018年 kingsic. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface SGPagingViewPopGestureVC : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// SGPagingViewPopGestureVC.m | ||
// SGPagingViewExample | ||
// | ||
// Created by kingsic on 2018/9/1. | ||
// Copyright © 2018年 kingsic. All rights reserved. | ||
// | ||
|
||
#import "SGPagingViewPopGestureVC.h" | ||
|
||
@interface SGPagingViewPopGestureVC () <UIGestureRecognizerDelegate> { | ||
id<UIGestureRecognizerDelegate> _delegate; | ||
} | ||
@end | ||
|
||
@implementation SGPagingViewPopGestureVC | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
|
||
if (self.navigationController.viewControllers.count > 1) { | ||
// 记录系统返回手势的代理 | ||
_delegate = self.navigationController.interactivePopGestureRecognizer.delegate; | ||
// 设置系统返回手势的代理为当前控制器 | ||
self.navigationController.interactivePopGestureRecognizer.delegate = self; | ||
} | ||
} | ||
|
||
- (void)viewWillDisappear:(BOOL)animated { | ||
[super viewWillDisappear:animated]; | ||
|
||
// 设置系统返回手势的代理为我们刚进入控制器的时候记录的系统的返回手势代理 | ||
self.navigationController.interactivePopGestureRecognizer.delegate = _delegate; | ||
} | ||
|
||
#pragma mark - - UIGestureRecognizerDelegate | ||
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { | ||
return self.navigationController.childViewControllers.count > 1; | ||
} | ||
|
||
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { | ||
return self.navigationController.viewControllers.count > 1; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.