Skip to content

Commit

Permalink
iOS 13 简单适配,解决一些散退问题,和UIScreenEdgePanGestureRecognizer 手势在iOS13 失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Gdxy committed Sep 24, 2019
1 parent eb340b1 commit da217f5
Show file tree
Hide file tree
Showing 24 changed files with 424 additions and 96 deletions.
26 changes: 24 additions & 2 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
1466E7E221AFC14D001DC6FE /* TLSystemAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 1466E7E121AFC14D001DC6FE /* TLSystemAnimator.m */; };
148C5789227E7F2C00B9A052 /* TLLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 148C5788227E7F2C00B9A052 /* TLLoadingView.m */; };
149AA6B321955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 149AA6B221955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.m */; };
14A2C9AA2339AAA500F751AE /* TestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A2C9A92339AAA500F751AE /* TestViewController.m */; };
14A2C9AD2339B78B00F751AE /* TestView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A2C9AC2339B78B00F751AE /* TestView.m */; };
14A2C9B02339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A2C9AF2339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.m */; };
14A539CA219C139B00DB5CE6 /* TLCATransitonAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A539C9219C139B00DB5CE6 /* TLCATransitonAnimator.m */; };
14B08832218FEE4B0001B3EB /* TLWheelTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B08830218FEE4B0001B3EB /* TLWheelTableViewCell.m */; };
14B08833218FEE4B0001B3EB /* TLWheelTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 14B08831218FEE4B0001B3EB /* TLWheelTableViewCell.xib */; };
Expand Down Expand Up @@ -115,6 +118,12 @@
148C5788227E7F2C00B9A052 /* TLLoadingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TLLoadingView.m; sourceTree = "<group>"; };
149AA6B121955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLPercentDrivenInteractiveTransition.h; sourceTree = "<group>"; };
149AA6B221955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TLPercentDrivenInteractiveTransition.m; sourceTree = "<group>"; };
14A2C9A82339AAA500F751AE /* TestViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestViewController.h; sourceTree = "<group>"; };
14A2C9A92339AAA500F751AE /* TestViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestViewController.m; sourceTree = "<group>"; };
14A2C9AB2339B78B00F751AE /* TestView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestView.h; sourceTree = "<group>"; };
14A2C9AC2339B78B00F751AE /* TestView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestView.m; sourceTree = "<group>"; };
14A2C9AE2339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLScreenEdgePanGestureRecognizer.h; sourceTree = "<group>"; };
14A2C9AF2339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TLScreenEdgePanGestureRecognizer.m; sourceTree = "<group>"; };
14A539C8219C139B00DB5CE6 /* TLCATransitonAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLCATransitonAnimator.h; sourceTree = "<group>"; };
14A539C9219C139B00DB5CE6 /* TLCATransitonAnimator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TLCATransitonAnimator.m; sourceTree = "<group>"; };
14A539CB219C1BF400DB5CE6 /* TLAnimatorProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLAnimatorProtocol.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -297,6 +306,8 @@
14D39406219D0D1000F61677 /* TLTransitionDelegate.m */,
149AA6B121955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.h */,
149AA6B221955F2600F03EE6 /* TLPercentDrivenInteractiveTransition.m */,
14A2C9AE2339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.h */,
14A2C9AF2339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.m */,
);
path = TransitionController;
sourceTree = "<group>";
Expand Down Expand Up @@ -387,6 +398,10 @@
142741C6218861CC0047EE09 /* TLSecondViewController.xib */,
14BC7FF621B0E7A900B982EC /* TLRegisterInteractiveController.h */,
14BC7FF721B0E7A900B982EC /* TLRegisterInteractiveController.m */,
14A2C9A82339AAA500F751AE /* TestViewController.h */,
14A2C9A92339AAA500F751AE /* TestViewController.m */,
14A2C9AB2339B78B00F751AE /* TestView.h */,
14A2C9AC2339B78B00F751AE /* TestView.m */,
);
path = Common;
sourceTree = "<group>";
Expand Down Expand Up @@ -523,8 +538,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
14A2C9AD2339B78B00F751AE /* TestView.m in Sources */,
142D0F1621AD221B00257EF1 /* TLAppStoreListController.m in Sources */,
14A539CA219C139B00DB5CE6 /* TLCATransitonAnimator.m in Sources */,
14A2C9AA2339AAA500F751AE /* TestViewController.m in Sources */,
142741C12186E18B0047EE09 /* TLTransition.m in Sources */,
14469F8721A52C4A007525BA /* TLAnimator.m in Sources */,
1402DFBE21B624DA00E875C0 /* TLCodeViewConroller.m in Sources */,
Expand Down Expand Up @@ -552,6 +569,7 @@
14BD4D3921B937420004B738 /* TLModalMenuController.m in Sources */,
142741DB218BFBE40047EE09 /* TLFirstTableController.m in Sources */,
142741D8218BEBD70047EE09 /* TLSwipeAnimator.m in Sources */,
14A2C9B02339BD0B00F751AE /* TLScreenEdgePanGestureRecognizer.m in Sources */,
14BC7FF821B0E7A900B982EC /* TLRegisterInteractiveController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -717,14 +735,16 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.1;
DEVELOPMENT_TEAM = DA3ZJPDSKE;
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.gxdy.Example;
MARKETING_VERSION = 2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.gxdy.TLTransitionsExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -739,14 +759,16 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2.1;
DEVELOPMENT_TEAM = DA3ZJPDSKE;
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.gxdy.Example;
MARKETING_VERSION = 2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.gxdy.TLTransitionsExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h";
SWIFT_VERSION = 4.2;
Expand Down
10 changes: 4 additions & 6 deletions Example/Example/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -27,7 +25,7 @@
<color key="shadowColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<size key="shadowOffset" width="0.0" height="0.0"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="TLTransitions V1.4.7" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0g7-JW-aWb">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="TLTransitions V1.4.9" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0g7-JW-aWb">
<rect key="frame" x="16" y="201" width="343" height="82"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="MarkerFelt-Thin" family="Marker Felt" pointSize="36"/>
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/Common/TLRegisterInteractiveController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ - (void)viewDidLoad {
- (IBAction)showCode:(UIButton *)sender {
TLCodeViewConroller *codeVc = [TLCodeViewConroller new];
codeVc.imgName = @"registerInteractive";
TLCATransitonAnimator *anm = [TLCATransitonAnimator animatorWithTransitionType:TLTransitionRippleEffect
TLCATransitonAnimator *anm = [TLCATransitonAnimator animatorWithTransitionType:TLTransitionFade
direction:TLDirectionToLeft
transitionTypeOfDismiss:TLTransitionRippleEffect
transitionTypeOfDismiss:TLTransitionFade
directionOfDismiss:TLDirectionToRight];
[self presentViewController:codeVc animator:anm completion:nil];
}
Expand Down
5 changes: 1 addition & 4 deletions Example/Example/Common/TLSecondViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ - (IBAction)present:(UIButton *)sender {
- (IBAction)showCode:(UIButton *)sender {
TLCodeViewConroller *codeVc = [TLCodeViewConroller new];
codeVc.imgName = _imgName;
TLCATransitonAnimator *anm = [TLCATransitonAnimator animatorWithTransitionType:TLTransitionRippleEffect
direction:TLDirectionToLeft
transitionTypeOfDismiss:TLTransitionRippleEffect
directionOfDismiss:TLDirectionToRight];
TLSystemAnimator *anm = [TLSystemAnimator animatorWithStyle:0 fullScreen:NO];
[self presentViewController:codeVc animator:anm completion:nil];
}

Expand Down
16 changes: 7 additions & 9 deletions Example/Example/Common/TLSecondViewController.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -32,11 +30,11 @@
</label>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="img" translatesAutoresizingMaskIntoConstraints="NO" id="Not-hf-YMZ">
<rect key="frame" x="0.0" y="457" width="375" height="210"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Re-zX-27L">
<rect key="frame" x="55" y="328" width="264" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.57810515169999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="dismiss"/>
<connections>
Expand All @@ -45,7 +43,7 @@
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="h6O-bT-PP2">
<rect key="frame" x="55" y="410" width="264" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.29853495959999998" green="0.84600949290000005" blue="0.39043116570000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="左侧滑或击按钮可以继续present"/>
<connections>
Expand All @@ -67,6 +65,6 @@
</view>
</objects>
<resources>
<image name="img" width="959" height="540"/>
<image name="img" width="1918" height="1080"/>
</resources>
</document>
17 changes: 17 additions & 0 deletions Example/Example/Common/TestView.h
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
27 changes: 27 additions & 0 deletions Example/Example/Common/TestView.m
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
17 changes: 17 additions & 0 deletions Example/Example/Common/TestViewController.h
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
74 changes: 74 additions & 0 deletions Example/Example/Common/TestViewController.m
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
4 changes: 2 additions & 2 deletions Example/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>2.0</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
Loading

0 comments on commit da217f5

Please sign in to comment.