├── .gitignore ├── LICENSE ├── README.md ├── YFLDragCardView.podspec ├── YFLDragCardView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── YFLDragCardView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── finder_dislike_btn.imageset │ │ ├── Contents.json │ │ ├── finder_dislike_btn@2x.png │ │ └── finder_dislike_btn@3x.png │ └── finder_like_btn.imageset │ │ ├── Contents.json │ │ ├── finder_like_btn@2x.png │ │ └── finder_like_btn@3x.png ├── Base.lproj │ └── LaunchScreen.storyboard ├── CardView.h ├── CardView.m ├── Info.plist ├── Lib │ ├── YFLDragCardContainer.h │ ├── YFLDragCardContainer.m │ ├── YFLDragCardView.h │ ├── YFLDragCardView.m │ ├── YFLDragConfigure.h │ └── YFLDragConfigure.m ├── MainViewController.h ├── MainViewController.m ├── main.m ├── resource │ ├── image_1.jpg │ ├── image_2.jpg │ ├── image_3.jpg │ ├── image_4.jpg │ ├── image_5.jpg │ ├── image_6.jpg │ ├── image_7.jpg │ ├── image_8.jpg │ └── image_9.jpg └── screensShots │ └── IMG_3694.GIF ├── YFLDragCardViewTests ├── Info.plist └── YFLDragCardViewTests.m └── YFLDragCardViewUITests ├── Info.plist └── YFLDragCardViewUITests.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 杨飞龙 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 仿探探、陌陌社交软件左右滑动找好友,效果图如下 2 |
3 | 4 | # 自定义说明 5 | 支持自定义卡牌样式,继承YFLDragCardView类,并重写- (void)YFLDragCardViewLayoutSubviews 方法,在该方法里布局子视图即可。 6 | 7 | # 安装说明 8 | 支持cocoapods, pod 'YFLDragCardView', '~> 1.0.0' 9 | 10 | 也可手动导入工程Lib目录下源代码文件 11 | 12 | # 示例代码 13 | ``` 14 | YFLDragConfigure *configure = [[YFLDragConfigure alloc]init]; 15 | configure.visableCount = 3; 16 | configure.containerEdge = 10.0f; 17 | configure.cardEdge = 5.0f; 18 | configure.cardCornerRadius = 10.0f; 19 | configure.cardCornerBorderWidth = 0.45f; 20 | configure.cardBordColor = [UIColor colorWithRed:176.0f/255.0f green:176.0f/255.0f blue:176.0f/255.0f alpha:1]; 21 | self.container = [[YFLDragCardContainer alloc]initWithFrame:CGRectMake(0, 100, ScreenWidth, 400) configure:configure]; 22 | self.container.dataSource = self; 23 | self.container.delegate = self; 24 | [self.view addSubview:self.container]; 25 | [self.container reloadData]; 26 | 27 | 或者默认初始化方法 28 | self.container = [[YFLDragCardContainer alloc]initWithFrame:CGRectMake(0, 100, ScreenWidth, 400)]; 29 | self.container.dataSource = self; 30 | self.container.delegate = self; 31 | [self.view addSubview:self.container]; 32 | [self.container reloadData]; 33 | ``` 34 | 35 | # 数据源方法 36 | ``` 37 | - (NSInteger)numberOfRowsInYFLDragCardContainer:(YFLDragCardContainer *)container 38 | { 39 | return self.data.count; 40 | 41 | }// 多少张卡牌 42 | 43 | - (YFLDragCardView *)container:(YFLDragCardContainer *)container viewForRowsAtIndex:(NSInteger)index 44 | { 45 | return [YFLDragCardView new]; 46 | 47 | }// 自定义卡牌样式(返回YFLDragCardView子类对象即可) 48 | ``` 49 | # 代理方法 50 | ``` 51 | - (void)container:(YFLDragCardContainer *)container didSelectRowAtIndex:(NSInteger)index 52 | { 53 | NSLog(@"didSelectRowAtIndex :%ld",(long)index); 54 | 55 | }//点击事件 56 | 57 | - (void)container:(YFLDragCardContainer *)container dataSourceIsEmpty:(BOOL)isEmpty 58 | { 59 | // TO DO 60 | 61 | }// isEmpty=YES,数据源为空 62 | 63 | - (BOOL)container:(YFLDragCardContainer *)container canDragForCardView:(YFLDragCardView *)cardView 64 | { 65 | return YES; 66 | 67 | }// 卡牌是否支持编辑 68 | 69 | - (void)container:(YFLDragCardContainer *)container dargingForCardView:(YFLDragCardView *)cardView direction:(ContainerDragDirection)direction widthRate:(float)widthRate heightRate:(float)heightRate 70 | { 71 | // TO DO 72 | 73 | }//正在手势中 74 | 75 | - (void)container:(YFLDragCardContainer *)container dragDidFinshForDirection:(ContainerDragDirection)direction forCardView:(YFLDragCardView *)cardView 76 | { 77 | NSLog(@"disappear:%ld",(long)cardView.tag); 78 | 79 | }// disappear=YES,滑动结束 80 | ``` 81 | # 点击事件 82 | ``` 83 | - (void)removeCardViewForDirection:(ContainerDragDirection)direction 84 | ``` 85 | # 联系方式 86 | 87 | Email : 390151825@qq.com 88 | 89 | Blog : http://blog.csdn.net/qq_18505715 90 | -------------------------------------------------------------------------------- /YFLDragCardView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "YFLDragCardView" 4 | s.version = "1.0.0" 5 | s.summary = "仿探探、陌陌社交软件找左右滑动找好友." 6 | s.homepage = "https://github.com/CoderYangFeiLong/YFL_CardView" 7 | s.license = "MIT" 8 | s.author = { "Cherish" => "390151825@qq.com" } 9 | s.platform = :ios 10 | s.source = { :git => "https://github.com/CoderYangFeiLong/YFL_CardView.git", :tag => "1.0.0" } 11 | s.source_files = "YFLDragCardView/Lib/*.{h,m}" 12 | s.requires_arc = true 13 | 14 | end 15 | -------------------------------------------------------------------------------- /YFLDragCardView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1F18044F2160809F00F262F2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F18044E2160809F00F262F2 /* AppDelegate.m */; }; 11 | 1F180457216080A400F262F2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1F180456216080A400F262F2 /* Assets.xcassets */; }; 12 | 1F18045A216080A400F262F2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1F180458216080A400F262F2 /* LaunchScreen.storyboard */; }; 13 | 1F18045D216080A400F262F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F18045C216080A400F262F2 /* main.m */; }; 14 | 1F180467216080A400F262F2 /* YFLDragCardViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F180466216080A400F262F2 /* YFLDragCardViewTests.m */; }; 15 | 1F180472216080A400F262F2 /* YFLDragCardViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F180471216080A400F262F2 /* YFLDragCardViewUITests.m */; }; 16 | 1F180481216080FD00F262F2 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F180480216080FC00F262F2 /* MainViewController.m */; }; 17 | 1F1804962160813600F262F2 /* image_7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F18048D2160813600F262F2 /* image_7.jpg */; }; 18 | 1F1804972160813600F262F2 /* image_9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F18048E2160813600F262F2 /* image_9.jpg */; }; 19 | 1F1804982160813600F262F2 /* image_8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F18048F2160813600F262F2 /* image_8.jpg */; }; 20 | 1F1804992160813600F262F2 /* image_4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804902160813600F262F2 /* image_4.jpg */; }; 21 | 1F18049A2160813600F262F2 /* image_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804912160813600F262F2 /* image_1.jpg */; }; 22 | 1F18049B2160813600F262F2 /* image_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804922160813600F262F2 /* image_3.jpg */; }; 23 | 1F18049C2160813600F262F2 /* image_5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804932160813600F262F2 /* image_5.jpg */; }; 24 | 1F18049D2160813600F262F2 /* image_6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804942160813600F262F2 /* image_6.jpg */; }; 25 | 1F18049E2160813600F262F2 /* image_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804952160813600F262F2 /* image_2.jpg */; }; 26 | 1F1804A12160814700F262F2 /* IMG_3694.GIF in Resources */ = {isa = PBXBuildFile; fileRef = 1F1804A02160814700F262F2 /* IMG_3694.GIF */; }; 27 | 1F1804A42160815700F262F2 /* CardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1804A32160815700F262F2 /* CardView.m */; }; 28 | 1F1804B32160A4BA00F262F2 /* YFLDragCardContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1804AD2160A4BA00F262F2 /* YFLDragCardContainer.m */; }; 29 | 1F1804B42160A4BA00F262F2 /* YFLDragConfigure.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1804AF2160A4BA00F262F2 /* YFLDragConfigure.m */; }; 30 | 1F1804B52160A4BA00F262F2 /* YFLDragCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1804B12160A4BA00F262F2 /* YFLDragCardView.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 1F180463216080A400F262F2 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 1F1804422160809F00F262F2 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 1F1804492160809F00F262F2; 39 | remoteInfo = YFLDragCardView; 40 | }; 41 | 1F18046E216080A400F262F2 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 1F1804422160809F00F262F2 /* Project object */; 44 | proxyType = 1; 45 | remoteGlobalIDString = 1F1804492160809F00F262F2; 46 | remoteInfo = YFLDragCardView; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 1F18044A2160809F00F262F2 /* YFLDragCardView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YFLDragCardView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 1F18044D2160809F00F262F2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | 1F18044E2160809F00F262F2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | 1F180456216080A400F262F2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 1F180459216080A400F262F2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | 1F18045B216080A400F262F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 1F18045C216080A400F262F2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 58 | 1F180462216080A400F262F2 /* YFLDragCardViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YFLDragCardViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 1F180466216080A400F262F2 /* YFLDragCardViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YFLDragCardViewTests.m; sourceTree = ""; }; 60 | 1F180468216080A400F262F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | 1F18046D216080A400F262F2 /* YFLDragCardViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YFLDragCardViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 1F180471216080A400F262F2 /* YFLDragCardViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YFLDragCardViewUITests.m; sourceTree = ""; }; 63 | 1F180473216080A400F262F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 1F18047F216080FC00F262F2 /* MainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 65 | 1F180480216080FC00F262F2 /* MainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 66 | 1F18048D2160813600F262F2 /* image_7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_7.jpg; sourceTree = ""; }; 67 | 1F18048E2160813600F262F2 /* image_9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_9.jpg; sourceTree = ""; }; 68 | 1F18048F2160813600F262F2 /* image_8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_8.jpg; sourceTree = ""; }; 69 | 1F1804902160813600F262F2 /* image_4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_4.jpg; sourceTree = ""; }; 70 | 1F1804912160813600F262F2 /* image_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_1.jpg; sourceTree = ""; }; 71 | 1F1804922160813600F262F2 /* image_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_3.jpg; sourceTree = ""; }; 72 | 1F1804932160813600F262F2 /* image_5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_5.jpg; sourceTree = ""; }; 73 | 1F1804942160813600F262F2 /* image_6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_6.jpg; sourceTree = ""; }; 74 | 1F1804952160813600F262F2 /* image_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_2.jpg; sourceTree = ""; }; 75 | 1F1804A02160814700F262F2 /* IMG_3694.GIF */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = IMG_3694.GIF; sourceTree = ""; }; 76 | 1F1804A22160815700F262F2 /* CardView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardView.h; sourceTree = ""; }; 77 | 1F1804A32160815700F262F2 /* CardView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CardView.m; sourceTree = ""; }; 78 | 1F1804AD2160A4BA00F262F2 /* YFLDragCardContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFLDragCardContainer.m; sourceTree = ""; }; 79 | 1F1804AE2160A4BA00F262F2 /* YFLDragCardView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFLDragCardView.h; sourceTree = ""; }; 80 | 1F1804AF2160A4BA00F262F2 /* YFLDragConfigure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFLDragConfigure.m; sourceTree = ""; }; 81 | 1F1804B02160A4BA00F262F2 /* YFLDragCardContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFLDragCardContainer.h; sourceTree = ""; }; 82 | 1F1804B12160A4BA00F262F2 /* YFLDragCardView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YFLDragCardView.m; sourceTree = ""; }; 83 | 1F1804B22160A4BA00F262F2 /* YFLDragConfigure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YFLDragConfigure.h; sourceTree = ""; }; 84 | /* End PBXFileReference section */ 85 | 86 | /* Begin PBXFrameworksBuildPhase section */ 87 | 1F1804472160809F00F262F2 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | 1F18045F216080A400F262F2 /* Frameworks */ = { 95 | isa = PBXFrameworksBuildPhase; 96 | buildActionMask = 2147483647; 97 | files = ( 98 | ); 99 | runOnlyForDeploymentPostprocessing = 0; 100 | }; 101 | 1F18046A216080A400F262F2 /* Frameworks */ = { 102 | isa = PBXFrameworksBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | ); 106 | runOnlyForDeploymentPostprocessing = 0; 107 | }; 108 | /* End PBXFrameworksBuildPhase section */ 109 | 110 | /* Begin PBXGroup section */ 111 | 1F1804412160809F00F262F2 = { 112 | isa = PBXGroup; 113 | children = ( 114 | 1F18044C2160809F00F262F2 /* YFLDragCardView */, 115 | 1F180465216080A400F262F2 /* YFLDragCardViewTests */, 116 | 1F180470216080A400F262F2 /* YFLDragCardViewUITests */, 117 | 1F18044B2160809F00F262F2 /* Products */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | 1F18044B2160809F00F262F2 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 1F18044A2160809F00F262F2 /* YFLDragCardView.app */, 125 | 1F180462216080A400F262F2 /* YFLDragCardViewTests.xctest */, 126 | 1F18046D216080A400F262F2 /* YFLDragCardViewUITests.xctest */, 127 | ); 128 | name = Products; 129 | sourceTree = ""; 130 | }; 131 | 1F18044C2160809F00F262F2 /* YFLDragCardView */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 1F1804B62160A60E00F262F2 /* screensShots */, 135 | 1F1804AC2160A4B900F262F2 /* Lib */, 136 | 1F1804A92160A38A00F262F2 /* resource */, 137 | 1F18044D2160809F00F262F2 /* AppDelegate.h */, 138 | 1F18044E2160809F00F262F2 /* AppDelegate.m */, 139 | 1F18047F216080FC00F262F2 /* MainViewController.h */, 140 | 1F180480216080FC00F262F2 /* MainViewController.m */, 141 | 1F1804A22160815700F262F2 /* CardView.h */, 142 | 1F1804A32160815700F262F2 /* CardView.m */, 143 | 1F180456216080A400F262F2 /* Assets.xcassets */, 144 | 1F180458216080A400F262F2 /* LaunchScreen.storyboard */, 145 | 1F18045B216080A400F262F2 /* Info.plist */, 146 | 1F18045C216080A400F262F2 /* main.m */, 147 | ); 148 | path = YFLDragCardView; 149 | sourceTree = ""; 150 | }; 151 | 1F180465216080A400F262F2 /* YFLDragCardViewTests */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 1F180466216080A400F262F2 /* YFLDragCardViewTests.m */, 155 | 1F180468216080A400F262F2 /* Info.plist */, 156 | ); 157 | path = YFLDragCardViewTests; 158 | sourceTree = ""; 159 | }; 160 | 1F180470216080A400F262F2 /* YFLDragCardViewUITests */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 1F180471216080A400F262F2 /* YFLDragCardViewUITests.m */, 164 | 1F180473216080A400F262F2 /* Info.plist */, 165 | ); 166 | path = YFLDragCardViewUITests; 167 | sourceTree = ""; 168 | }; 169 | 1F1804A92160A38A00F262F2 /* resource */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 1F1804912160813600F262F2 /* image_1.jpg */, 173 | 1F1804952160813600F262F2 /* image_2.jpg */, 174 | 1F1804922160813600F262F2 /* image_3.jpg */, 175 | 1F1804902160813600F262F2 /* image_4.jpg */, 176 | 1F1804932160813600F262F2 /* image_5.jpg */, 177 | 1F1804942160813600F262F2 /* image_6.jpg */, 178 | 1F18048D2160813600F262F2 /* image_7.jpg */, 179 | 1F18048F2160813600F262F2 /* image_8.jpg */, 180 | 1F18048E2160813600F262F2 /* image_9.jpg */, 181 | ); 182 | path = resource; 183 | sourceTree = ""; 184 | }; 185 | 1F1804AC2160A4B900F262F2 /* Lib */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 1F1804AD2160A4BA00F262F2 /* YFLDragCardContainer.m */, 189 | 1F1804AE2160A4BA00F262F2 /* YFLDragCardView.h */, 190 | 1F1804AF2160A4BA00F262F2 /* YFLDragConfigure.m */, 191 | 1F1804B02160A4BA00F262F2 /* YFLDragCardContainer.h */, 192 | 1F1804B12160A4BA00F262F2 /* YFLDragCardView.m */, 193 | 1F1804B22160A4BA00F262F2 /* YFLDragConfigure.h */, 194 | ); 195 | path = Lib; 196 | sourceTree = ""; 197 | }; 198 | 1F1804B62160A60E00F262F2 /* screensShots */ = { 199 | isa = PBXGroup; 200 | children = ( 201 | 1F1804A02160814700F262F2 /* IMG_3694.GIF */, 202 | ); 203 | path = screensShots; 204 | sourceTree = ""; 205 | }; 206 | /* End PBXGroup section */ 207 | 208 | /* Begin PBXNativeTarget section */ 209 | 1F1804492160809F00F262F2 /* YFLDragCardView */ = { 210 | isa = PBXNativeTarget; 211 | buildConfigurationList = 1F180476216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardView" */; 212 | buildPhases = ( 213 | 1F1804462160809F00F262F2 /* Sources */, 214 | 1F1804472160809F00F262F2 /* Frameworks */, 215 | 1F1804482160809F00F262F2 /* Resources */, 216 | ); 217 | buildRules = ( 218 | ); 219 | dependencies = ( 220 | ); 221 | name = YFLDragCardView; 222 | productName = YFLDragCardView; 223 | productReference = 1F18044A2160809F00F262F2 /* YFLDragCardView.app */; 224 | productType = "com.apple.product-type.application"; 225 | }; 226 | 1F180461216080A400F262F2 /* YFLDragCardViewTests */ = { 227 | isa = PBXNativeTarget; 228 | buildConfigurationList = 1F180479216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardViewTests" */; 229 | buildPhases = ( 230 | 1F18045E216080A400F262F2 /* Sources */, 231 | 1F18045F216080A400F262F2 /* Frameworks */, 232 | 1F180460216080A400F262F2 /* Resources */, 233 | ); 234 | buildRules = ( 235 | ); 236 | dependencies = ( 237 | 1F180464216080A400F262F2 /* PBXTargetDependency */, 238 | ); 239 | name = YFLDragCardViewTests; 240 | productName = YFLDragCardViewTests; 241 | productReference = 1F180462216080A400F262F2 /* YFLDragCardViewTests.xctest */; 242 | productType = "com.apple.product-type.bundle.unit-test"; 243 | }; 244 | 1F18046C216080A400F262F2 /* YFLDragCardViewUITests */ = { 245 | isa = PBXNativeTarget; 246 | buildConfigurationList = 1F18047C216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardViewUITests" */; 247 | buildPhases = ( 248 | 1F180469216080A400F262F2 /* Sources */, 249 | 1F18046A216080A400F262F2 /* Frameworks */, 250 | 1F18046B216080A400F262F2 /* Resources */, 251 | ); 252 | buildRules = ( 253 | ); 254 | dependencies = ( 255 | 1F18046F216080A400F262F2 /* PBXTargetDependency */, 256 | ); 257 | name = YFLDragCardViewUITests; 258 | productName = YFLDragCardViewUITests; 259 | productReference = 1F18046D216080A400F262F2 /* YFLDragCardViewUITests.xctest */; 260 | productType = "com.apple.product-type.bundle.ui-testing"; 261 | }; 262 | /* End PBXNativeTarget section */ 263 | 264 | /* Begin PBXProject section */ 265 | 1F1804422160809F00F262F2 /* Project object */ = { 266 | isa = PBXProject; 267 | attributes = { 268 | LastUpgradeCheck = 0940; 269 | ORGANIZATIONNAME = Cherish; 270 | TargetAttributes = { 271 | 1F1804492160809F00F262F2 = { 272 | CreatedOnToolsVersion = 9.4.1; 273 | }; 274 | 1F180461216080A400F262F2 = { 275 | CreatedOnToolsVersion = 9.4.1; 276 | TestTargetID = 1F1804492160809F00F262F2; 277 | }; 278 | 1F18046C216080A400F262F2 = { 279 | CreatedOnToolsVersion = 9.4.1; 280 | TestTargetID = 1F1804492160809F00F262F2; 281 | }; 282 | }; 283 | }; 284 | buildConfigurationList = 1F1804452160809F00F262F2 /* Build configuration list for PBXProject "YFLDragCardView" */; 285 | compatibilityVersion = "Xcode 9.3"; 286 | developmentRegion = en; 287 | hasScannedForEncodings = 0; 288 | knownRegions = ( 289 | en, 290 | Base, 291 | ); 292 | mainGroup = 1F1804412160809F00F262F2; 293 | productRefGroup = 1F18044B2160809F00F262F2 /* Products */; 294 | projectDirPath = ""; 295 | projectRoot = ""; 296 | targets = ( 297 | 1F1804492160809F00F262F2 /* YFLDragCardView */, 298 | 1F180461216080A400F262F2 /* YFLDragCardViewTests */, 299 | 1F18046C216080A400F262F2 /* YFLDragCardViewUITests */, 300 | ); 301 | }; 302 | /* End PBXProject section */ 303 | 304 | /* Begin PBXResourcesBuildPhase section */ 305 | 1F1804482160809F00F262F2 /* Resources */ = { 306 | isa = PBXResourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 1F18049E2160813600F262F2 /* image_2.jpg in Resources */, 310 | 1F18049D2160813600F262F2 /* image_6.jpg in Resources */, 311 | 1F1804A12160814700F262F2 /* IMG_3694.GIF in Resources */, 312 | 1F18045A216080A400F262F2 /* LaunchScreen.storyboard in Resources */, 313 | 1F1804972160813600F262F2 /* image_9.jpg in Resources */, 314 | 1F1804992160813600F262F2 /* image_4.jpg in Resources */, 315 | 1F180457216080A400F262F2 /* Assets.xcassets in Resources */, 316 | 1F1804982160813600F262F2 /* image_8.jpg in Resources */, 317 | 1F1804962160813600F262F2 /* image_7.jpg in Resources */, 318 | 1F18049A2160813600F262F2 /* image_1.jpg in Resources */, 319 | 1F18049B2160813600F262F2 /* image_3.jpg in Resources */, 320 | 1F18049C2160813600F262F2 /* image_5.jpg in Resources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | 1F180460216080A400F262F2 /* Resources */ = { 325 | isa = PBXResourcesBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | 1F18046B216080A400F262F2 /* Resources */ = { 332 | isa = PBXResourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | /* End PBXResourcesBuildPhase section */ 339 | 340 | /* Begin PBXSourcesBuildPhase section */ 341 | 1F1804462160809F00F262F2 /* Sources */ = { 342 | isa = PBXSourcesBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | 1F1804B42160A4BA00F262F2 /* YFLDragConfigure.m in Sources */, 346 | 1F1804B32160A4BA00F262F2 /* YFLDragCardContainer.m in Sources */, 347 | 1F18045D216080A400F262F2 /* main.m in Sources */, 348 | 1F180481216080FD00F262F2 /* MainViewController.m in Sources */, 349 | 1F18044F2160809F00F262F2 /* AppDelegate.m in Sources */, 350 | 1F1804A42160815700F262F2 /* CardView.m in Sources */, 351 | 1F1804B52160A4BA00F262F2 /* YFLDragCardView.m in Sources */, 352 | ); 353 | runOnlyForDeploymentPostprocessing = 0; 354 | }; 355 | 1F18045E216080A400F262F2 /* Sources */ = { 356 | isa = PBXSourcesBuildPhase; 357 | buildActionMask = 2147483647; 358 | files = ( 359 | 1F180467216080A400F262F2 /* YFLDragCardViewTests.m in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | 1F180469216080A400F262F2 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 1F180472216080A400F262F2 /* YFLDragCardViewUITests.m in Sources */, 368 | ); 369 | runOnlyForDeploymentPostprocessing = 0; 370 | }; 371 | /* End PBXSourcesBuildPhase section */ 372 | 373 | /* Begin PBXTargetDependency section */ 374 | 1F180464216080A400F262F2 /* PBXTargetDependency */ = { 375 | isa = PBXTargetDependency; 376 | target = 1F1804492160809F00F262F2 /* YFLDragCardView */; 377 | targetProxy = 1F180463216080A400F262F2 /* PBXContainerItemProxy */; 378 | }; 379 | 1F18046F216080A400F262F2 /* PBXTargetDependency */ = { 380 | isa = PBXTargetDependency; 381 | target = 1F1804492160809F00F262F2 /* YFLDragCardView */; 382 | targetProxy = 1F18046E216080A400F262F2 /* PBXContainerItemProxy */; 383 | }; 384 | /* End PBXTargetDependency section */ 385 | 386 | /* Begin PBXVariantGroup section */ 387 | 1F180458216080A400F262F2 /* LaunchScreen.storyboard */ = { 388 | isa = PBXVariantGroup; 389 | children = ( 390 | 1F180459216080A400F262F2 /* Base */, 391 | ); 392 | name = LaunchScreen.storyboard; 393 | sourceTree = ""; 394 | }; 395 | /* End PBXVariantGroup section */ 396 | 397 | /* Begin XCBuildConfiguration section */ 398 | 1F180474216080A400F262F2 /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ALWAYS_SEARCH_USER_PATHS = NO; 402 | CLANG_ANALYZER_NONNULL = YES; 403 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 404 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 405 | CLANG_CXX_LIBRARY = "libc++"; 406 | CLANG_ENABLE_MODULES = YES; 407 | CLANG_ENABLE_OBJC_ARC = YES; 408 | CLANG_ENABLE_OBJC_WEAK = YES; 409 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_COMMA = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 414 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 415 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 416 | CLANG_WARN_EMPTY_BODY = YES; 417 | CLANG_WARN_ENUM_CONVERSION = YES; 418 | CLANG_WARN_INFINITE_RECURSION = YES; 419 | CLANG_WARN_INT_CONVERSION = YES; 420 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 421 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 422 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 423 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 424 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 425 | CLANG_WARN_STRICT_PROTOTYPES = YES; 426 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 427 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 428 | CLANG_WARN_UNREACHABLE_CODE = YES; 429 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 430 | CODE_SIGN_IDENTITY = "iPhone Developer"; 431 | COPY_PHASE_STRIP = NO; 432 | DEBUG_INFORMATION_FORMAT = dwarf; 433 | ENABLE_STRICT_OBJC_MSGSEND = YES; 434 | ENABLE_TESTABILITY = YES; 435 | GCC_C_LANGUAGE_STANDARD = gnu11; 436 | GCC_DYNAMIC_NO_PIC = NO; 437 | GCC_NO_COMMON_BLOCKS = YES; 438 | GCC_OPTIMIZATION_LEVEL = 0; 439 | GCC_PREPROCESSOR_DEFINITIONS = ( 440 | "DEBUG=1", 441 | "$(inherited)", 442 | ); 443 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 444 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 445 | GCC_WARN_UNDECLARED_SELECTOR = YES; 446 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 447 | GCC_WARN_UNUSED_FUNCTION = YES; 448 | GCC_WARN_UNUSED_VARIABLE = YES; 449 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 450 | MTL_ENABLE_DEBUG_INFO = YES; 451 | ONLY_ACTIVE_ARCH = YES; 452 | SDKROOT = iphoneos; 453 | }; 454 | name = Debug; 455 | }; 456 | 1F180475216080A400F262F2 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ALWAYS_SEARCH_USER_PATHS = NO; 460 | CLANG_ANALYZER_NONNULL = YES; 461 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 462 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 463 | CLANG_CXX_LIBRARY = "libc++"; 464 | CLANG_ENABLE_MODULES = YES; 465 | CLANG_ENABLE_OBJC_ARC = YES; 466 | CLANG_ENABLE_OBJC_WEAK = YES; 467 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 468 | CLANG_WARN_BOOL_CONVERSION = YES; 469 | CLANG_WARN_COMMA = YES; 470 | CLANG_WARN_CONSTANT_CONVERSION = YES; 471 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 473 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 474 | CLANG_WARN_EMPTY_BODY = YES; 475 | CLANG_WARN_ENUM_CONVERSION = YES; 476 | CLANG_WARN_INFINITE_RECURSION = YES; 477 | CLANG_WARN_INT_CONVERSION = YES; 478 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 480 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 483 | CLANG_WARN_STRICT_PROTOTYPES = YES; 484 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 485 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 486 | CLANG_WARN_UNREACHABLE_CODE = YES; 487 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 488 | CODE_SIGN_IDENTITY = "iPhone Developer"; 489 | COPY_PHASE_STRIP = NO; 490 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 491 | ENABLE_NS_ASSERTIONS = NO; 492 | ENABLE_STRICT_OBJC_MSGSEND = YES; 493 | GCC_C_LANGUAGE_STANDARD = gnu11; 494 | GCC_NO_COMMON_BLOCKS = YES; 495 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 496 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 497 | GCC_WARN_UNDECLARED_SELECTOR = YES; 498 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 499 | GCC_WARN_UNUSED_FUNCTION = YES; 500 | GCC_WARN_UNUSED_VARIABLE = YES; 501 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 502 | MTL_ENABLE_DEBUG_INFO = NO; 503 | SDKROOT = iphoneos; 504 | VALIDATE_PRODUCT = YES; 505 | }; 506 | name = Release; 507 | }; 508 | 1F180477216080A400F262F2 /* Debug */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CODE_SIGN_STYLE = Automatic; 513 | DEVELOPMENT_TEAM = K9V7FM4SGX; 514 | INFOPLIST_FILE = YFLDragCardView/Info.plist; 515 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 516 | LD_RUNPATH_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "@executable_path/Frameworks", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardView; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | TARGETED_DEVICE_FAMILY = 1; 523 | }; 524 | name = Debug; 525 | }; 526 | 1F180478216080A400F262F2 /* Release */ = { 527 | isa = XCBuildConfiguration; 528 | buildSettings = { 529 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 530 | CODE_SIGN_STYLE = Automatic; 531 | DEVELOPMENT_TEAM = K9V7FM4SGX; 532 | INFOPLIST_FILE = YFLDragCardView/Info.plist; 533 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 534 | LD_RUNPATH_SEARCH_PATHS = ( 535 | "$(inherited)", 536 | "@executable_path/Frameworks", 537 | ); 538 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardView; 539 | PRODUCT_NAME = "$(TARGET_NAME)"; 540 | TARGETED_DEVICE_FAMILY = 1; 541 | }; 542 | name = Release; 543 | }; 544 | 1F18047A216080A400F262F2 /* Debug */ = { 545 | isa = XCBuildConfiguration; 546 | buildSettings = { 547 | BUNDLE_LOADER = "$(TEST_HOST)"; 548 | CODE_SIGN_STYLE = Automatic; 549 | INFOPLIST_FILE = YFLDragCardViewTests/Info.plist; 550 | LD_RUNPATH_SEARCH_PATHS = ( 551 | "$(inherited)", 552 | "@executable_path/Frameworks", 553 | "@loader_path/Frameworks", 554 | ); 555 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardViewTests; 556 | PRODUCT_NAME = "$(TARGET_NAME)"; 557 | TARGETED_DEVICE_FAMILY = "1,2"; 558 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YFLDragCardView.app/YFLDragCardView"; 559 | }; 560 | name = Debug; 561 | }; 562 | 1F18047B216080A400F262F2 /* Release */ = { 563 | isa = XCBuildConfiguration; 564 | buildSettings = { 565 | BUNDLE_LOADER = "$(TEST_HOST)"; 566 | CODE_SIGN_STYLE = Automatic; 567 | INFOPLIST_FILE = YFLDragCardViewTests/Info.plist; 568 | LD_RUNPATH_SEARCH_PATHS = ( 569 | "$(inherited)", 570 | "@executable_path/Frameworks", 571 | "@loader_path/Frameworks", 572 | ); 573 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardViewTests; 574 | PRODUCT_NAME = "$(TARGET_NAME)"; 575 | TARGETED_DEVICE_FAMILY = "1,2"; 576 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YFLDragCardView.app/YFLDragCardView"; 577 | }; 578 | name = Release; 579 | }; 580 | 1F18047D216080A400F262F2 /* Debug */ = { 581 | isa = XCBuildConfiguration; 582 | buildSettings = { 583 | CODE_SIGN_STYLE = Automatic; 584 | INFOPLIST_FILE = YFLDragCardViewUITests/Info.plist; 585 | LD_RUNPATH_SEARCH_PATHS = ( 586 | "$(inherited)", 587 | "@executable_path/Frameworks", 588 | "@loader_path/Frameworks", 589 | ); 590 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardViewUITests; 591 | PRODUCT_NAME = "$(TARGET_NAME)"; 592 | TARGETED_DEVICE_FAMILY = "1,2"; 593 | TEST_TARGET_NAME = YFLDragCardView; 594 | }; 595 | name = Debug; 596 | }; 597 | 1F18047E216080A400F262F2 /* Release */ = { 598 | isa = XCBuildConfiguration; 599 | buildSettings = { 600 | CODE_SIGN_STYLE = Automatic; 601 | INFOPLIST_FILE = YFLDragCardViewUITests/Info.plist; 602 | LD_RUNPATH_SEARCH_PATHS = ( 603 | "$(inherited)", 604 | "@executable_path/Frameworks", 605 | "@loader_path/Frameworks", 606 | ); 607 | PRODUCT_BUNDLE_IDENTIFIER = com.lemon.YFLDragCardViewUITests; 608 | PRODUCT_NAME = "$(TARGET_NAME)"; 609 | TARGETED_DEVICE_FAMILY = "1,2"; 610 | TEST_TARGET_NAME = YFLDragCardView; 611 | }; 612 | name = Release; 613 | }; 614 | /* End XCBuildConfiguration section */ 615 | 616 | /* Begin XCConfigurationList section */ 617 | 1F1804452160809F00F262F2 /* Build configuration list for PBXProject "YFLDragCardView" */ = { 618 | isa = XCConfigurationList; 619 | buildConfigurations = ( 620 | 1F180474216080A400F262F2 /* Debug */, 621 | 1F180475216080A400F262F2 /* Release */, 622 | ); 623 | defaultConfigurationIsVisible = 0; 624 | defaultConfigurationName = Release; 625 | }; 626 | 1F180476216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardView" */ = { 627 | isa = XCConfigurationList; 628 | buildConfigurations = ( 629 | 1F180477216080A400F262F2 /* Debug */, 630 | 1F180478216080A400F262F2 /* Release */, 631 | ); 632 | defaultConfigurationIsVisible = 0; 633 | defaultConfigurationName = Release; 634 | }; 635 | 1F180479216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardViewTests" */ = { 636 | isa = XCConfigurationList; 637 | buildConfigurations = ( 638 | 1F18047A216080A400F262F2 /* Debug */, 639 | 1F18047B216080A400F262F2 /* Release */, 640 | ); 641 | defaultConfigurationIsVisible = 0; 642 | defaultConfigurationName = Release; 643 | }; 644 | 1F18047C216080A400F262F2 /* Build configuration list for PBXNativeTarget "YFLDragCardViewUITests" */ = { 645 | isa = XCConfigurationList; 646 | buildConfigurations = ( 647 | 1F18047D216080A400F262F2 /* Debug */, 648 | 1F18047E216080A400F262F2 /* Release */, 649 | ); 650 | defaultConfigurationIsVisible = 0; 651 | defaultConfigurationName = Release; 652 | }; 653 | /* End XCConfigurationList section */ 654 | }; 655 | rootObject = 1F1804422160809F00F262F2 /* Project object */; 656 | } 657 | -------------------------------------------------------------------------------- /YFLDragCardView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YFLDragCardView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /YFLDragCardView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YFLDragCardView 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /YFLDragCardView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YFLDragCardView 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "MainViewController.h" 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | self.window.backgroundColor = [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]; 22 | self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController: [[MainViewController alloc]init]]; 23 | [self.window makeKeyAndVisible]; 24 | 25 | return YES; 26 | } 27 | 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_dislike_btn.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "finder_dislike_btn@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "finder_dislike_btn@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_dislike_btn.imageset/finder_dislike_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/Assets.xcassets/finder_dislike_btn.imageset/finder_dislike_btn@2x.png -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_dislike_btn.imageset/finder_dislike_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/Assets.xcassets/finder_dislike_btn.imageset/finder_dislike_btn@3x.png -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_like_btn.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "finder_like_btn@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "finder_like_btn@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_like_btn.imageset/finder_like_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/Assets.xcassets/finder_like_btn.imageset/finder_like_btn@2x.png -------------------------------------------------------------------------------- /YFLDragCardView/Assets.xcassets/finder_like_btn.imageset/finder_like_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/Assets.xcassets/finder_like_btn.imageset/finder_like_btn@3x.png -------------------------------------------------------------------------------- /YFLDragCardView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /YFLDragCardView/CardView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CardView.h 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "YFLDragCardView.h" 10 | 11 | @interface CardView : YFLDragCardView 12 | 13 | - (void)setAnimationwithDriection:(ContainerDragDirection)direction; 14 | 15 | - (void)setImage:(NSString*)imageName title:(NSString*)title; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /YFLDragCardView/CardView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CardView.m 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "CardView.h" 10 | 11 | @interface CardView() 12 | 13 | @property (nonatomic,strong) UIImageView *imageView; 14 | 15 | @property (nonatomic,strong) UILabel *title; 16 | 17 | // dislike 18 | @property (nonatomic,strong) UIImageView *dislike; 19 | // like 20 | @property (nonatomic,strong) UIImageView *like; 21 | 22 | @end 23 | 24 | @implementation CardView 25 | 26 | - (id)initWithFrame:(CGRect)frame 27 | { 28 | self = [super initWithFrame:frame]; 29 | if (self) { 30 | [self setUp]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)setUp 37 | { 38 | self.backgroundColor = [UIColor whiteColor]; 39 | self.imageView = [[UIImageView alloc]init]; 40 | self.imageView.layer.cornerRadius = 4.0f; 41 | self.imageView.layer.masksToBounds = YES; 42 | [self addSubview:self.imageView]; 43 | 44 | self.title = [[UILabel alloc]init]; 45 | self.title.textColor = [UIColor blackColor]; 46 | self.title.backgroundColor = [UIColor whiteColor]; 47 | self.title.textAlignment = NSTextAlignmentCenter; 48 | self.title.font = [UIFont boldSystemFontOfSize:18.0f]; 49 | [self addSubview:self.title]; 50 | 51 | self.dislike = [[UIImageView alloc]init]; 52 | self.dislike.image = [UIImage imageNamed:@"finder_dislike_btn"]; 53 | self.dislike.alpha = 0.0f; 54 | [self addSubview:self.dislike]; 55 | 56 | self.like = [[UIImageView alloc]init]; 57 | self.like.image = [UIImage imageNamed:@"finder_like_btn"]; 58 | self.like.alpha = 0.0f; 59 | [self addSubview:self.like]; 60 | 61 | } 62 | 63 | - (void)YFLDragCardViewLayoutSubviews 64 | { 65 | self.imageView.frame = CGRectMake(5, 5, self.frame.size.width-10, self.frame.size.height-50); 66 | self.title.frame = CGRectMake(0,self.imageView.frame.size.height+5, self.frame.size.width, 30); 67 | self.like.frame = CGRectMake(16, 16, 75, 75); 68 | self.dislike.frame = CGRectMake(self.frame.size.width-21-75, 16, 75, 75); 69 | } 70 | 71 | - (void)setImage:(NSString*)imageName title:(NSString*)title 72 | { 73 | self.imageView.image = [UIImage imageNamed:imageName]; 74 | self.title.text = title; 75 | 76 | } 77 | 78 | - (void)setAnimationwithDriection:(ContainerDragDirection)direction 79 | { 80 | if (direction == ContainerDragLeft) { 81 | 82 | self.like.alpha = 0.0f; 83 | [UIView animateWithDuration:0.2f animations:^{ 84 | if (self.dislike) { 85 | self.dislike.alpha = 1.0f; 86 | self.dislike.transform = CGAffineTransformMakeRotation(45*M_PI / 180.0); 87 | } 88 | }]; 89 | }else if(direction == ContainerDragRight){ 90 | 91 | self.dislike.alpha = 0.0f; 92 | [UIView animateWithDuration:0.2f animations:^{ 93 | if (self.like) { 94 | self.like.alpha = 1.0f; 95 | self.like.transform = CGAffineTransformMakeRotation(-45*M_PI / 180.0); 96 | } 97 | }]; 98 | }else{ 99 | 100 | self.like.alpha = 0.0f; 101 | self.dislike.alpha = 0.0f; 102 | [UIView animateWithDuration:0.2 animations:^{ 103 | if (self.like) { 104 | self.like.transform = CGAffineTransformMakeRotation(45*M_PI / 180.0); 105 | } 106 | if (self.dislike) { 107 | self.dislike.transform = CGAffineTransformMakeRotation(-45*M_PI / 180.0); 108 | } 109 | }]; 110 | } 111 | } 112 | 113 | 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /YFLDragCardView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleVersion 20 | 1.0.0 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragCardContainer.h: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardContainer.h 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YFLDragCardView.h" 11 | @class YFLDragCardContainer; 12 | 13 | @protocol YFLDragCardContainerDataSource 14 | 15 | @required 16 | 17 | /** 数据源个数 **/ 18 | - (NSInteger)numberOfRowsInYFLDragCardContainer:(YFLDragCardContainer *)container; 19 | 20 | /** 显示数据源 **/ 21 | - (YFLDragCardView *)container:(YFLDragCardContainer *)container viewForRowsAtIndex:(NSInteger)index; 22 | 23 | @end 24 | 25 | @protocol YFLDragCardContainerDelegate 26 | 27 | @optional 28 | 29 | /** 点击卡片回调 **/ 30 | - (void)container:(YFLDragCardContainer *)container didSelectRowAtIndex:(NSInteger)index; 31 | 32 | /** 拖到最后一张卡片 YES,空,可继续调用reloadData分页数据**/ 33 | - (void)container:(YFLDragCardContainer *)container dataSourceIsEmpty:(BOOL)isEmpty; 34 | 35 | /** 当前cardview 是否可以拖拽,默认YES **/ 36 | - (BOOL)container:(YFLDragCardContainer *)container canDragForCardView:(YFLDragCardView *)cardView; 37 | 38 | /** 卡片处于拖拽中回调**/ 39 | - (void)container:(YFLDragCardContainer *)container dargingForCardView:(YFLDragCardView *)cardView direction:(ContainerDragDirection)direction widthRate:(float)widthRate heightRate:(float)heightRate; 40 | 41 | /** 卡片拖拽结束回调(卡片消失) **/ 42 | - (void)container:(YFLDragCardContainer *)container dragDidFinshForDirection:(ContainerDragDirection)direction forCardView:(YFLDragCardView *)cardView; 43 | 44 | @end 45 | 46 | 47 | @interface YFLDragCardContainer : UIView 48 | 49 | 50 | /** 初始化方法 **/ 51 | - (instancetype)initWithFrame:(CGRect)frame configure:(YFLDragConfigure*)configure; 52 | 53 | /** 默认初始化方法 **/ 54 | - (instancetype)initWithFrame:(CGRect)frame; 55 | 56 | /** 数据源代理 **/ 57 | @property (nonatomic, weak, nullable) id dataSource; 58 | 59 | /** 动作代理 **/ 60 | @property (nonatomic, weak, nullable) id delegate; 61 | 62 | /** 刷新数据 **/ 63 | - (void)reloadData; 64 | 65 | /** 主动调用拖拽 **/ 66 | - (void)removeCardViewForDirection:(ContainerDragDirection)direction; 67 | 68 | /** 获取显示当前卡片 **/ 69 | - (YFLDragCardView *)getCurrentShowCardView; 70 | 71 | /** 获取显示当前卡片的index **/ 72 | - (NSInteger)getCurrentShowCardViewIndex; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragCardContainer.m: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardContainer.m 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "YFLDragCardContainer.h" 10 | #import "YFLDragConfigure.h" 11 | @interface YFLDragCardContainer() 12 | /** YFLDragCardView实例的集合 **/ 13 | @property (nonatomic,strong) NSMutableArray *cards; 14 | /** 滑动方向 **/ 15 | @property (nonatomic,assign) ContainerDragDirection direction; 16 | /** 是否滑动 **/ 17 | @property (nonatomic,assign) BOOL isMoveIng; 18 | /** 已加载个数 **/ 19 | @property (nonatomic,assign) NSInteger loadedIndex; 20 | /** 记录第一个card的farme **/ 21 | @property (nonatomic,assign) CGRect firstCardFrame; 22 | /** 记录最后一个card的frame **/ 23 | @property (nonatomic,assign) CGRect lastCardFrame; 24 | /** 记录card的center **/ 25 | @property (nonatomic,assign) CGPoint cardCenter; 26 | /** 记录最后一个card的transform **/ 27 | @property (nonatomic,assign) CGAffineTransform lastCardTransform; 28 | 29 | @property (nonatomic,strong) YFLDragConfigure *configure; 30 | 31 | @end 32 | 33 | @implementation YFLDragCardContainer 34 | 35 | #pragma mark - Init Methods 36 | - (instancetype)initWithFrame:(CGRect)frame 37 | { 38 | return [self initWithFrame:frame configure:[self setDefaultsConfigures]]; 39 | } 40 | 41 | - (instancetype)initWithFrame:(CGRect)frame configure:(YFLDragConfigure*)configure 42 | { 43 | self = [super initWithFrame:frame]; 44 | if (self){ 45 | [self initDataConfigure:configure]; 46 | } 47 | return self; 48 | } 49 | 50 | #pragma mark - Private Methods 51 | - (YFLDragConfigure*)setDefaultsConfigures 52 | { 53 | YFLDragConfigure *configure = [[YFLDragConfigure alloc]init]; 54 | configure.visableCount = 3; 55 | configure.containerEdge = 10.0f; 56 | configure.cardEdge = 5.0f; 57 | configure.cardCornerRadius = 10.0f; 58 | configure.cardCornerBorderWidth = 0.45f; 59 | configure.cardBordColor = [UIColor colorWithRed:176.0f/255.0f green:176.0f/255.0f blue:176.0f/255.0f alpha:1]; 60 | return configure; 61 | } 62 | 63 | - (void)initDataConfigure:(YFLDragConfigure*)configure 64 | { 65 | [self resetInitData]; 66 | self.cards = [[NSMutableArray alloc]init]; 67 | self.backgroundColor = [UIColor whiteColor]; 68 | self.configure = !configure ? [self setDefaultsConfigures] : configure; 69 | } 70 | 71 | - (void)resetInitData 72 | { 73 | self.loadedIndex = 0; 74 | self.direction = ContainerDragDefaults; 75 | self.isMoveIng = NO; 76 | 77 | }//重置数据(为了二次调用reload) 78 | 79 | 80 | - (void)addSubViews 81 | { 82 | NSInteger sum = [self.dataSource numberOfRowsInYFLDragCardContainer:self]; 83 | NSInteger preLoadViewCount = (sum <= self.configure.visableCount) ? sum : self.configure.visableCount; 84 | //预防越界 85 | if (self.loadedIndex < sum){ 86 | // 当手势滑动,加载第四个,最多创建4个。不存在内存warning。(手势停止,滑动的view没消失,需要干掉多创建的+1) 87 | for (NSInteger i = self.cards.count; i < (self.isMoveIng ? preLoadViewCount+1:preLoadViewCount); i++){ 88 | YFLDragCardView *cardView = [self.dataSource container:self viewForRowsAtIndex:self.loadedIndex]; 89 | cardView.frame = CGRectMake(self.configure.containerEdge, self.configure.containerEdge, self.frame.size.width-2*self.configure.containerEdge, self.frame.size.height-2*(self.configure.containerEdge+self.configure.cardEdge)); 90 | [cardView setConfigure:self.configure]; 91 | [cardView YFLDragCardViewLayoutSubviews]; 92 | [self recordFrame:cardView]; 93 | cardView.tag = self.loadedIndex; 94 | [cardView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGesture:)]]; 95 | [cardView addGestureRecognizer:[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePanGesture:)]]; 96 | [self addSubview:cardView]; 97 | [self sendSubviewToBack:cardView]; 98 | [self.cards addObject:cardView]; 99 | self.loadedIndex += 1; 100 | } 101 | } 102 | }//添加子视图 103 | 104 | - (void)resetLayoutSubviews 105 | { 106 | //动画时允许用户交流,比如触摸 | 时间曲线函数,缓入缓出,中间快 107 | [UIView animateWithDuration:0.5f delay:0.0f usingSpringWithDamping:0.6 initialSpringVelocity:0.6 options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseInOut animations:^{ 108 | if ([self.delegate respondsToSelector:@selector(container:dargingForCardView:direction:widthRate:heightRate:)]) { 109 | [self.delegate container:self dargingForCardView:self.cards.firstObject direction:self.direction widthRate:0 heightRate:0]; 110 | } 111 | 112 | for (int i = 0; i < self.cards.count; i++){ 113 | YFLDragCardView *cardView = [self.cards objectAtIndex:i]; 114 | cardView.transform = CGAffineTransformIdentity; 115 | CGRect frame = self.firstCardFrame; 116 | 117 | switch (i) { 118 | case 0: 119 | cardView.frame = frame; 120 | break; 121 | case 1: 122 | { 123 | frame.origin.y = frame.origin.y+self.configure.cardEdge; 124 | cardView.frame = frame; 125 | cardView.transform = CGAffineTransformScale(CGAffineTransformIdentity, secondCardScale, 1); 126 | } 127 | break; 128 | case 2: 129 | { 130 | frame.origin.y = frame.origin.y+2*self.configure.cardEdge; 131 | cardView.frame = frame; 132 | cardView.transform = CGAffineTransformScale(CGAffineTransformIdentity, thirdCardScale, 1); 133 | if (CGRectIsEmpty(self.lastCardFrame)) { 134 | self.lastCardFrame = frame; 135 | self.lastCardTransform = cardView.transform; 136 | } 137 | } 138 | break; 139 | default: 140 | break; 141 | } 142 | cardView.originTransForm = cardView.transform; 143 | } 144 | 145 | } completion:^(BOOL finished) { 146 | BOOL isEmpty = self.cards.count == 0 ? YES : NO; 147 | if (self.delegate && [self.delegate respondsToSelector:@selector(container:dataSourceIsEmpty:)]) { 148 | [self.delegate container:self dataSourceIsEmpty:isEmpty]; 149 | } 150 | }]; 151 | 152 | 153 | }//布局子视图 154 | 155 | - (void)recordFrame:(YFLDragCardView *)cardView 156 | { 157 | if (self.loadedIndex >= 3){ 158 | cardView.frame = self.lastCardFrame; 159 | }else{ 160 | CGRect frame = cardView.frame; 161 | if (CGRectIsEmpty(self.firstCardFrame)){ 162 | self.firstCardFrame = frame; 163 | self.cardCenter = cardView.center; 164 | } 165 | } 166 | } 167 | 168 | - (void)moveIngStatusChange:(float)scale 169 | { 170 | //如果正在移动,添加第四个 171 | if (!self.isMoveIng) { 172 | self.isMoveIng = YES; 173 | [self addSubViews]; 174 | }else{ 175 | //第四个加载完,立马改变没作用在手势上其他cardview的scale 176 | scale = fabsf(scale) >= boundaryRation ? boundaryRation : fabsf(scale); 177 | CGFloat transFormtxPoor = (secondCardScale-thirdCardScale)/(boundaryRation/scale); 178 | CGFloat frameYPoor = self.configure.cardEdge/(boundaryRation/scale); // frame y差值 179 | 180 | for (int index = 1; index < self.cards.count ; index++) { 181 | YFLDragCardView *cardView = (YFLDragCardView *)self.cards[index]; 182 | switch (index) { 183 | case 1: 184 | { 185 | CGAffineTransform scale = CGAffineTransformScale(CGAffineTransformIdentity, transFormtxPoor + secondCardScale, 1); 186 | CGAffineTransform translate = CGAffineTransformTranslate(scale, 0, -frameYPoor); 187 | cardView.transform = translate; 188 | } 189 | break; 190 | 191 | case 2: 192 | { 193 | CGAffineTransform scale = CGAffineTransformScale(CGAffineTransformIdentity, transFormtxPoor + thirdCardScale, 1); 194 | CGAffineTransform translate = CGAffineTransformTranslate(scale, 0, -frameYPoor); 195 | cardView.transform = translate; 196 | 197 | } 198 | break; 199 | 200 | case 3: 201 | { 202 | cardView.transform = self.lastCardTransform; 203 | } 204 | break; 205 | 206 | default: 207 | break; 208 | } 209 | 210 | } 211 | 212 | 213 | } 214 | 215 | }//移动卡片 216 | 217 | - (void)panGesturemMoveFinishOrCancle:(YFLDragCardView*)cardView direction:(ContainerDragDirection)direction scale:(float)scale isDisappear:(BOOL)isDisappear 218 | { 219 | if (!isDisappear) { 220 | //干掉多创建的第四个.重置标量 221 | if (self.isMoveIng && self.cards.count > self.configure.visableCount) { 222 | YFLDragCardView *lastView = (YFLDragCardView *)self.cards.lastObject; 223 | [lastView removeFromSuperview]; 224 | [self.cards removeObject:lastView]; 225 | self.loadedIndex = lastView.tag; 226 | } 227 | self.isMoveIng = NO; 228 | [self resetLayoutSubviews]; 229 | }else{ 230 | if ([self.delegate respondsToSelector:@selector(container:dragDidFinshForDirection:forCardView:)]) { 231 | [self.delegate container:self dragDidFinshForDirection:self.direction forCardView:cardView]; 232 | } 233 | NSInteger flag = (direction == ContainerDragLeft?-1:2); 234 | [UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{ 235 | cardView.center = CGPointMake(flag*ScreenWidth, flag*ScreenWidth/scale+self.cardCenter.y); 236 | } completion:^(BOOL finished) { 237 | [cardView removeFromSuperview]; 238 | }]; 239 | [self.cards removeObject:cardView]; 240 | self.isMoveIng = NO; 241 | [self resetLayoutSubviews]; 242 | } 243 | 244 | }//手势结束 245 | 246 | #pragma mark - Public Methods 247 | - (void)reloadData 248 | { 249 | if (self.dataSource && [self.dataSource respondsToSelector:@selector(numberOfRowsInYFLDragCardContainer:)] && [self.dataSource respondsToSelector:@selector(container:viewForRowsAtIndex:)]) { 250 | [self resetInitData]; 251 | [self addSubViews]; 252 | [self resetLayoutSubviews]; 253 | }else{ 254 | NSAssert(self.dataSource, @"check dataSource and dataSource Methods!"); 255 | } 256 | 257 | } 258 | 259 | - (YFLDragCardView *)getCurrentShowCardView 260 | { 261 | return self.cards.firstObject; 262 | } 263 | 264 | - (NSInteger)getCurrentShowCardViewIndex 265 | { 266 | return self.cards.firstObject.tag; 267 | } 268 | 269 | - (void)removeCardViewForDirection:(ContainerDragDirection)direction 270 | { 271 | if (self.isMoveIng) return; 272 | CGPoint cardCenter = CGPointZero; 273 | NSInteger flag = 0; 274 | switch (direction) { 275 | 276 | case ContainerDragLeft: 277 | { cardCenter = CGPointMake(-ScreenWidth/2.0, self.cardCenter.y); 278 | flag = -1; 279 | } 280 | break; 281 | case ContainerDragRight: 282 | { 283 | cardCenter = CGPointMake(ScreenWidth*1.5, self.cardCenter.y); 284 | flag = 1; 285 | 286 | } 287 | break; 288 | default: 289 | break; 290 | } 291 | 292 | YFLDragCardView *currentShowCardView = self.cards.firstObject; 293 | [UIView animateWithDuration:0.35 animations:^{ 294 | CGAffineTransform translate = CGAffineTransformTranslate(CGAffineTransformIdentity, flag * 20, 0); 295 | currentShowCardView.transform = CGAffineTransformRotate(translate, flag * M_PI_4 / 4); 296 | currentShowCardView.center = cardCenter; 297 | } completion:^(BOOL finished) { 298 | 299 | [currentShowCardView removeFromSuperview]; 300 | [self.cards removeObject:currentShowCardView]; 301 | [self addSubViews]; 302 | [self resetLayoutSubviews]; 303 | 304 | }]; 305 | 306 | //卡片滑动结束的代理(可用户发送数据请求) 307 | if ([self.delegate respondsToSelector:@selector(container:dragDidFinshForDirection:forCardView:)]) { 308 | [self.delegate container:self dragDidFinshForDirection:direction forCardView:currentShowCardView]; 309 | } 310 | 311 | 312 | }//手动点击移除 313 | 314 | #pragma mark - Action Methods 315 | - (void)handleTapGesture:(UITapGestureRecognizer*)tap 316 | { 317 | if ([self.delegate respondsToSelector:@selector(container:didSelectRowAtIndex:)]){ 318 | [self.delegate container:self didSelectRowAtIndex:tap.view.tag]; 319 | } 320 | 321 | }//单击手势 322 | 323 | - (void)handlePanGesture:(UIPanGestureRecognizer*)pan 324 | { 325 | BOOL canEdit = YES; 326 | if ([self.delegate respondsToSelector:@selector(container:canDragForCardView:)]) { 327 | canEdit = [self.delegate container:self canDragForCardView:(YFLDragCardView*)pan.view]; 328 | } 329 | 330 | if (canEdit) { 331 | if (pan.state == UIGestureRecognizerStateBegan){ 332 | // TO DO 333 | }else if (pan.state == UIGestureRecognizerStateChanged){ 334 | 335 | YFLDragCardView *cardView = (YFLDragCardView *)pan.view; 336 | //以自身的左上角为原点;每次移动后,原点都置0;计算的是相对于上一个位置的偏移; 337 | CGPoint point = [pan translationInView:self]; 338 | cardView.center = CGPointMake(pan.view.center.x+point.x, pan.view.center.y+point.y); 339 | 340 | //当angle为正值时,逆时针旋转坐标系统,反之顺时针旋转坐标系统 341 | cardView.transform = CGAffineTransformRotate(cardView.originTransForm, (pan.view.center.x-self.cardCenter.x)/self.cardCenter.x*(M_PI_4/12)); 342 | 343 | [pan setTranslation:CGPointZero inView:self]; // 设置坐标原点位上次的坐标 344 | 345 | if ([self.delegate respondsToSelector:@selector(container:dargingForCardView:direction:widthRate:heightRate:)]) { 346 | 347 | //计算横向滑动比例 >0 向右 <0 向左 348 | float horizionSliderRate = (pan.view.center.x-self.cardCenter.x)/self.cardCenter.x; 349 | float verticalSliderRate = (pan.view.center.y-self.cardCenter.y)/self.cardCenter.y; 350 | 351 | //正在滑动,需要创建第四个。 352 | [self moveIngStatusChange:horizionSliderRate]; 353 | 354 | if (horizionSliderRate > 0) { 355 | self.direction = ContainerDragRight; 356 | }else if (horizionSliderRate < 0){ 357 | self.direction = ContainerDragLeft; 358 | }else{ 359 | self.direction = ContainerDragDefaults; 360 | } 361 | 362 | [self.delegate container:self dargingForCardView:cardView direction:self.direction widthRate:horizionSliderRate heightRate:verticalSliderRate]; 363 | } 364 | }else if (pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateEnded){ 365 | //还原,或者消失 366 | float horizionSliderRate = (pan.view.center.x-self.cardCenter.x)/self.cardCenter.x; 367 | float moveY = (pan.view.center.y-self.cardCenter.y); 368 | float moveX = (pan.view.center.x-self.cardCenter.x); 369 | [self panGesturemMoveFinishOrCancle:(YFLDragCardView*)pan.view direction:self.direction scale:moveX/moveY isDisappear:fabs(horizionSliderRate)>boundaryRation]; 370 | 371 | } 372 | } 373 | } 374 | 375 | @end 376 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragCardView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardBaseView.h 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YFLDragConfigure.h" 11 | @interface YFLDragCardView : UIView 12 | 13 | 14 | @property (nonatomic,assign) CGAffineTransform originTransForm; 15 | 16 | @property (nonatomic,strong) YFLDragConfigure *configure; 17 | 18 | /** 19 | 布局子视图,其子类重写,并在其进行布局 20 | */ 21 | - (void)YFLDragCardViewLayoutSubviews; 22 | 23 | 24 | /** 25 | 执行卡片上动画(喜欢、不喜欢) 26 | */ 27 | - (void)startAnimatingForDirection:(ContainerDragDirection)direction; 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragCardView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardBaseView.m 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "YFLDragCardView.h" 10 | 11 | @interface YFLDragCardView() 12 | 13 | @property (nonatomic,strong) UIImageView *like; 14 | 15 | @property (nonatomic,strong) UIImageView *dislike; 16 | 17 | @end 18 | 19 | @implementation YFLDragCardView 20 | 21 | #pragma mark - Init Method 22 | - (id)initWithFrame:(CGRect)frame 23 | { 24 | self = [super initWithFrame:frame]; 25 | 26 | if (self) { 27 | 28 | [self setUp]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)awakeFromNib 34 | { 35 | [super awakeFromNib]; 36 | [self setUp]; 37 | } 38 | 39 | #pragma mark - Private Method 40 | - (void)setUp 41 | { 42 | self.userInteractionEnabled = YES; 43 | self.backgroundColor = [UIColor cyanColor]; 44 | } 45 | 46 | #pragma mark - Public Method 47 | - (void)setConfigure:(YFLDragConfigure *)configure 48 | { 49 | _configure = configure; 50 | self.layer.cornerRadius = configure.cardCornerRadius; 51 | self.layer.borderWidth = configure.cardCornerBorderWidth; 52 | self.layer.borderColor = configure.cardBordColor.CGColor; 53 | self.layer.masksToBounds = YES; 54 | } 55 | 56 | - (void)YFLDragCardViewLayoutSubviews 57 | { 58 | //TO DO 59 | } 60 | 61 | 62 | - (void)startAnimatingForDirection:(ContainerDragDirection)direction 63 | { 64 | //TO DO 65 | } 66 | 67 | 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragConfigure.h 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/26. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // 边界比 12 | static const CGFloat boundaryRation = 0.8f; 13 | static const CGFloat secondCardScale = 0.95f; 14 | static const CGFloat thirdCardScale = 0.90f; 15 | 16 | typedef NS_ENUM(NSInteger, ContainerDragDirection) 17 | { 18 | ContainerDragDefaults, 19 | ContainerDragLeft, 20 | ContainerDragRight 21 | }; 22 | 23 | @interface YFLDragConfigure : NSObject 24 | 25 | @property (nonatomic,assign) ContainerDragDirection direction; 26 | 27 | /** 可见个数 默认为 3 **/ 28 | @property (nonatomic,assign) NSInteger visableCount; 29 | /** 卡片边距 默认为10.0f **/ 30 | @property (nonatomic,assign) CGFloat containerEdge; 31 | /** 卡片内边距 默认为5.0f **/ 32 | @property (nonatomic,assign) CGFloat cardEdge; 33 | /** 卡片圆角 默认为10.0f **/ 34 | @property (nonatomic,assign) CGFloat cardCornerRadius; 35 | /** 卡片边缘宽度 默认为0.45f **/ 36 | @property (nonatomic,assign) CGFloat cardCornerBorderWidth; 37 | /** 卡片边缘颜色 **/ 38 | @property (nonatomic,strong) UIColor *cardBordColor; 39 | 40 | 41 | /** 物理屏幕宽度 **/ 42 | #define ScreenWidth UIScreen.mainScreen.bounds.size.width 43 | /** 物理屏幕高度 **/ 44 | #define ScreenHeight UIScreen.mainScreen.bounds.size.height 45 | 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /YFLDragCardView/Lib/YFLDragConfigure.m: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragConfigure.m 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/26. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "YFLDragConfigure.h" 10 | 11 | @implementation YFLDragConfigure 12 | 13 | - (NSInteger)visableCount 14 | { 15 | return _visableCount == 0 ? 3 : _visableCount; 16 | } 17 | 18 | - (CGFloat)containerEdge 19 | { 20 | return !(_containerEdge>0) ? 10.0f: _containerEdge; 21 | } 22 | 23 | - (CGFloat)cardEdge 24 | { 25 | return !(_cardEdge>0) ? 10.0f:_cardEdge; 26 | } 27 | 28 | - (CGFloat)cardCornerRadius 29 | { 30 | return !(_cardCornerRadius>0) ? 10.0f:_cardCornerRadius; 31 | } 32 | 33 | - (CGFloat)cardCornerBorderWidth 34 | { 35 | return !(_cardCornerBorderWidth>0) ? 0.45f:_cardCornerBorderWidth; 36 | } 37 | 38 | - (UIColor*)cardBordColor 39 | { 40 | return !_cardBordColor ? [UIColor colorWithRed:176.0f/255.0f green:176.0f/255.0f blue:176.0f/255.0f alpha:1]:_cardBordColor; 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /YFLDragCardView/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // YFLDragCardView 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YFLDragCardView/MainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.m 3 | // YFLDragCardViewProject 4 | // 5 | // Created by Cherish on 2018/9/18. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import "MainViewController.h" 10 | #import "YFLDragCardContainer.h" 11 | #import "CardView.h" 12 | @interface MainViewController () 13 | 14 | @property (nonatomic,strong) NSMutableArray *names; 15 | 16 | @property (nonatomic,strong) NSMutableArray *titles; 17 | 18 | @property (nonatomic,strong) YFLDragCardContainer *container; 19 | 20 | @property (nonatomic,strong) NSMutableArray *controllers; 21 | 22 | @end 23 | 24 | @implementation MainViewController 25 | 26 | #pragma mark - ViewController Life 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | 31 | self.title = @"仿探探、陌陌左右滑动"; 32 | self.controllers = [[NSMutableArray alloc]init]; 33 | 34 | self.container = [[YFLDragCardContainer alloc]initWithFrame:CGRectMake(0, 100, ScreenWidth, 400)]; 35 | self.container .dataSource = self; 36 | self.container .delegate = self; 37 | [self.view addSubview:self.container]; 38 | 39 | self.names = [[NSMutableArray alloc]init]; 40 | self.titles = [[NSMutableArray alloc]init]; 41 | 42 | for (int i = 1; i < 9; i++) { 43 | [self.names addObject:[NSString stringWithFormat:@"image_%d.jpg",i]]; 44 | [self.titles addObject:[NSString stringWithFormat:@"Page %d",i]]; 45 | } 46 | 47 | [self.container reloadData]; 48 | 49 | NSArray *btnImageNames = @[@"finder_dislike_btn",@"finder_like_btn"]; 50 | NSArray *methodNames = @[@"dislikeAction:",@"likeAction:"]; 51 | CGFloat originX = (self.view.frame.size.width-75*2-70)/2.0; 52 | for (int index = 0;index < btnImageNames.count; index++) { 53 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 54 | [btn setImage:[UIImage imageNamed:btnImageNames[index]] forState:UIControlStateNormal]; 55 | [btn addTarget:self action:NSSelectorFromString(methodNames[index]) forControlEvents:UIControlEventTouchUpInside]; 56 | [self.controllers addObject:btn]; 57 | [self.view addSubview:btn]; 58 | btn.frame = CGRectMake(originX+index*(75+70), self.container.frame.origin.y+self.container.frame.size.height+30, 75, 75); 59 | } 60 | 61 | } 62 | 63 | #pragma mark - YFLDragCardContainer DataSource 64 | - (NSInteger)numberOfRowsInYFLDragCardContainer:(YFLDragCardContainer *)container 65 | { 66 | return self.names.count; 67 | } 68 | 69 | - (YFLDragCardView *)container:(YFLDragCardContainer *)container viewForRowsAtIndex:(NSInteger)index 70 | { 71 | CardView *cardView = [[CardView alloc]initWithFrame:container.bounds]; 72 | [cardView setImage:self.names[index] title:self.titles[index]]; 73 | return cardView; 74 | } 75 | 76 | #pragma mark - YFLDragCardContainer Delegate 77 | - (void)container:(YFLDragCardContainer *)container didSelectRowAtIndex:(NSInteger)index 78 | { 79 | NSLog(@"didSelectRowAtIndex :%ld",(long)index); 80 | } 81 | 82 | - (void)container:(YFLDragCardContainer *)container dataSourceIsEmpty:(BOOL)isEmpty 83 | { 84 | if (isEmpty) { 85 | [container reloadData]; 86 | } 87 | } 88 | 89 | - (BOOL)container:(YFLDragCardContainer *)container canDragForCardView:(YFLDragCardView *)cardView 90 | { 91 | return YES; 92 | } 93 | 94 | - (void)container:(YFLDragCardContainer *)container dargingForCardView:(YFLDragCardView *)cardView direction:(ContainerDragDirection)direction widthRate:(float)widthRate heightRate:(float)heightRate 95 | { 96 | CardView*currentShowCardView = (CardView*)cardView; 97 | CGFloat scale = 1 + ((boundaryRation > fabs(widthRate) ? fabs(widthRate) : boundaryRation)) / 4; 98 | NSString *scaleString = [NSString stringWithFormat:@"%.2f",scale]; 99 | NSNumber *number = [NSNumber numberWithFloat:scaleString.floatValue]; 100 | direction = [number isEqual:@1] ? ContainerDragDefaults:direction; 101 | [currentShowCardView setAnimationwithDriection:direction]; 102 | 103 | } 104 | 105 | - (void)container:(YFLDragCardContainer *)container dragDidFinshForDirection:(ContainerDragDirection)direction forCardView:(YFLDragCardView *)cardView 106 | { 107 | NSLog(@"disappear:%ld",(long)cardView.tag); 108 | } 109 | 110 | 111 | #pragma mark - Action Methods 112 | - (void)dislikeAction:(UIButton*)sender 113 | { 114 | [self.container removeCardViewForDirection:ContainerDragLeft]; 115 | CardView *cardView = (CardView *)[self.container getCurrentShowCardView]; 116 | [cardView setAnimationwithDriection:ContainerDragLeft]; 117 | 118 | } 119 | 120 | - (void)likeAction:(UIButton*)sender 121 | { 122 | [self.container removeCardViewForDirection:ContainerDragRight]; 123 | CardView *cardView = (CardView *)[self.container getCurrentShowCardView]; 124 | [cardView setAnimationwithDriection:ContainerDragRight]; 125 | } 126 | 127 | #pragma mark - OverRide Methods 128 | - (BOOL)prefersStatusBarHidden 129 | { 130 | return NO; 131 | } 132 | 133 | @end 134 | 135 | -------------------------------------------------------------------------------- /YFLDragCardView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YFLDragCardView 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_1.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_2.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_3.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_4.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_5.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_6.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_7.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_8.jpg -------------------------------------------------------------------------------- /YFLDragCardView/resource/image_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/resource/image_9.jpg -------------------------------------------------------------------------------- /YFLDragCardView/screensShots/IMG_3694.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PursuitSunshine/YFL_CardView/8be71ebaa6691bcd3703c3b314664cbf94260c73/YFLDragCardView/screensShots/IMG_3694.GIF -------------------------------------------------------------------------------- /YFLDragCardViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /YFLDragCardViewTests/YFLDragCardViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardViewTests.m 3 | // YFLDragCardViewTests 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YFLDragCardViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation YFLDragCardViewTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /YFLDragCardViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /YFLDragCardViewUITests/YFLDragCardViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // YFLDragCardViewUITests.m 3 | // YFLDragCardViewUITests 4 | // 5 | // Created by Cherish on 2018/9/30. 6 | // Copyright © 2018年 Cherish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YFLDragCardViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation YFLDragCardViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------