-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iOS 13 简单适配,解决一些散退问题,和UIScreenEdgePanGestureRecognizer 手势在iOS13 失效问题
- Loading branch information
Gdxy
committed
Sep 24, 2019
1 parent
eb340b1
commit da217f5
Showing
24 changed files
with
424 additions
and
96 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
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
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,17 @@ | ||
// | ||
// TestView.h | ||
// Example | ||
// | ||
// Created by 故乡的云 on 2019/9/24. | ||
// Copyright © 2019 故乡的云. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TestView : UIView | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_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,27 @@ | ||
// | ||
// TestView.m | ||
// Example | ||
// | ||
// Created by 故乡的云 on 2019/9/24. | ||
// Copyright © 2019 故乡的云. All rights reserved. | ||
// | ||
|
||
#import "TestView.h" | ||
|
||
@implementation TestView | ||
|
||
/* | ||
// Only override drawRect: if you perform custom drawing. | ||
// An empty implementation adversely affects performance during animation. | ||
- (void)drawRect:(CGRect)rect { | ||
// Drawing code | ||
} | ||
*/ | ||
|
||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | ||
|
||
UIView *hitTestView = [super hitTest:point withEvent:event]; | ||
return hitTestView; | ||
} | ||
|
||
@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,17 @@ | ||
// | ||
// TestViewController.h | ||
// Example | ||
// | ||
// Created by 故乡的云 on 2019/9/24. | ||
// Copyright © 2019 故乡的云. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TestViewController : UIViewController | ||
@property(nonatomic, assign) BOOL swipeDismissEnable; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_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,74 @@ | ||
// | ||
// TestViewController.m | ||
// Example | ||
// | ||
// Created by 故乡的云 on 2019/9/24. | ||
// Copyright © 2019 故乡的云. All rights reserved. | ||
// | ||
|
||
#import "TestViewController.h" | ||
#import "TestView.h" | ||
#import "TLScreenEdgePanGestureRecognizer.h" | ||
|
||
@interface TestViewController ()<UIGestureRecognizerDelegate> | ||
|
||
@end | ||
|
||
@implementation TestViewController | ||
|
||
- (instancetype)init | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
// 1. 在父类统一集成,子类通过_swipeDismissEnable属性开启 | ||
self.swipeDismissEnable = YES; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
TestView *view = [[TestView alloc] initWithFrame:CGRectMake(100, 100, 300, 400)]; | ||
view.backgroundColor = [UIColor systemBlueColor]; | ||
[self.view addSubview:view]; | ||
|
||
TestView *subView = [[TestView alloc] initWithFrame:CGRectInset(view.bounds, 20, 20)]; | ||
subView.backgroundColor = [UIColor systemPinkColor]; | ||
[view addSubview:subView]; | ||
|
||
// 2. 创建侧滑手势 | ||
if (self.swipeDismissEnable) | ||
{ | ||
TLScreenEdgePanGestureRecognizer *edgePan; | ||
edgePan = [[TLScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss:)]; | ||
// 可以拓展为其它侧边滑动手势(如:右侧边滑动进行present...) | ||
edgePan.edges = UIRectEdgeLeft; | ||
[view addGestureRecognizer:edgePan]; | ||
} | ||
self.view.backgroundColor = [UIColor systemYellowColor]; | ||
} | ||
|
||
- (void)viewWillDisappear:(BOOL)animated { | ||
[super viewWillDisappear:animated]; | ||
|
||
} | ||
|
||
// MARK: - 侧滑Dismiss | ||
-(void)dismiss:(UIScreenEdgePanGestureRecognizer *)sender | ||
{ | ||
// if (self.swipeDismissEnable && sender.state == UIGestureRecognizerStateBegan) | ||
// { | ||
// 可以此处可以做出判断是需要执行Dismiss操作还是Pop操作 | ||
// 此处以Dismiss为列 | ||
// [self dismissViewControllerAnimated:YES completion:nil]; | ||
// } | ||
|
||
NSLog(@"%s",__func__); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
@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
Oops, something went wrong.