├── .gitignore ├── .travis.yml ├── LCPaintView.podspec ├── LCPaintView ├── LCBezierPath.h ├── LCBezierPath.m ├── LCPaintView.h └── LCPaintView.m ├── LCPaintViewDemo.png ├── LCPaintViewDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── Leo.xcuserdatad │ └── xcschemes │ ├── LCPaintViewDemo.xcscheme │ └── xcschememanagement.plist ├── LCPaintViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LCPaintViewDemoTests ├── Info.plist └── LCPaintViewDemoTests.m ├── LCPaintViewDemoUITests ├── Info.plist └── LCPaintViewDemoUITests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.moved-aside 3 | *.xcuserstate 4 | 5 | # CocoaPods 6 | # 7 | # We recommend against adding the Pods directory to your .gitignore. However 8 | # you should judge for yourself, the pros and cons are mentioned at: 9 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 10 | 11 | # Pods/ 12 | 13 | # Carthage 14 | # 15 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 16 | # Carthage/Checkouts 17 | 18 | # Carthage/Build 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | os: osx 3 | osx_image: xcode7.2 -------------------------------------------------------------------------------- /LCPaintView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "LCPaintView" 4 | s.version = "1.0.0" 5 | s.summary = "Paint view for iOS. Support: http://LeoDev.me" 6 | s.homepage = "https://github.com/iTofu/LCPaintView" 7 | s.license = "MIT" 8 | s.author = { "Leo" => "devtip@163.com" } 9 | s.social_media_url = "http://LeoDev.me" 10 | s.platform = :ios, "7.0" 11 | s.source = { :git => "https://github.com/iTofu/LCPaintView.git", :tag => s.version } 12 | s.source_files = "LCPaintView/**/*.{h,m}" 13 | s.requires_arc = true 14 | 15 | s.dependency "Masonry", '~> 1.0.1' 16 | 17 | end 18 | -------------------------------------------------------------------------------- /LCPaintView/LCBezierPath.h: -------------------------------------------------------------------------------- 1 | // 2 | // LCBezierPath.h 3 | // LCPaintView 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIBezierPath (LCBezierPath) 12 | 13 | /** 14 | The line color of the path. Default is `[UIColor whiteColor]`. 15 | */ 16 | @property (nonatomic, strong) UIColor *lineColor; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LCPaintView/LCBezierPath.m: -------------------------------------------------------------------------------- 1 | // 2 | // LCBezierPath.m 3 | // LCPaintView 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import "LCBezierPath.h" 10 | #import 11 | 12 | static const void *LineColorKey = &LineColorKey; 13 | 14 | @implementation UIBezierPath (LCBezierPath) 15 | 16 | @dynamic lineColor; 17 | 18 | - (instancetype)init { 19 | if (self = [super init]) { 20 | self.lineColor = [UIColor whiteColor]; 21 | self.lineWidth = 5.0f; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)setLineColor:(UIColor *)lineColor { 27 | objc_setAssociatedObject(self, LineColorKey, lineColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | } 29 | 30 | - (UIColor *)lineColor { 31 | return objc_getAssociatedObject(self, LineColorKey); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LCPaintView/LCPaintView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LCPaintView.h 3 | // LCPaintView 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | // LCPaintView 9 | // https://github.com/iTofu/LCPaintView 10 | // V 1.0.0 11 | 12 | #import 13 | 14 | @interface LCPaintView : UIView 15 | 16 | /** 17 | The line width of the path. Default is `5.0f`. 18 | */ 19 | @property (nonatomic, assign) float lineWidth; 20 | /** 21 | The line color of the path. Default is `[UIColor whiteColor]`. 22 | */ 23 | @property (nonatomic, strong) UIColor *lineColor; 24 | 25 | /** 26 | Clear all paths. 27 | */ 28 | - (void)clear; 29 | /** 30 | Undo. 31 | */ 32 | - (void)undo; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LCPaintView/LCPaintView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LCPaintView.m 3 | // LCPaintView 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import "LCPaintView.h" 10 | #import "LCBezierPath.h" 11 | 12 | @interface LCPaintView () 13 | 14 | @property (nonatomic, strong) NSMutableArray *paths; 15 | 16 | @end 17 | 18 | @implementation LCPaintView 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame { 21 | if (self = [super initWithFrame:frame]) { 22 | self.backgroundColor = [UIColor clearColor]; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)drawRect:(CGRect)rect { 28 | for (UIBezierPath *path in self.paths) { 29 | [path.lineColor set]; 30 | [path stroke]; 31 | } 32 | } 33 | 34 | - (NSMutableArray *)paths { 35 | if (!_paths) { 36 | _paths = [[NSMutableArray alloc] init]; 37 | } 38 | return _paths; 39 | } 40 | 41 | - (void)clear { 42 | [self.paths removeAllObjects]; 43 | 44 | [self setNeedsDisplay]; 45 | } 46 | 47 | - (void)undo { 48 | [self.paths removeLastObject]; 49 | 50 | [self setNeedsDisplay]; 51 | } 52 | 53 | #pragma mark - Handle Touches 54 | 55 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 56 | UITouch *touch = [touches anyObject]; 57 | CGPoint startPoint = [touch locationInView:touch.view]; 58 | 59 | UIBezierPath *path = [UIBezierPath bezierPath]; 60 | path.lineCapStyle = kCGLineCapRound; 61 | path.lineJoinStyle = kCGLineJoinRound; 62 | if (self.lineWidth != 0) { 63 | path.lineWidth = self.lineWidth; 64 | } 65 | if (self.lineColor) { 66 | path.lineColor = self.lineColor; 67 | } 68 | 69 | [path moveToPoint:startPoint]; 70 | 71 | [self.paths addObject:path]; 72 | 73 | [self setNeedsDisplay]; 74 | } 75 | 76 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 77 | UITouch *touch = [touches anyObject]; 78 | CGPoint currentPoint = [touch locationInView:touch.view]; 79 | 80 | UIBezierPath *path = [self.paths lastObject]; 81 | 82 | [path addLineToPoint:currentPoint]; 83 | 84 | [self setNeedsDisplay]; 85 | } 86 | 87 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 88 | 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /LCPaintViewDemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iTofu/LCPaintView/4f93569310287a776e219de62f34f2f8f7085396/LCPaintViewDemo.png -------------------------------------------------------------------------------- /LCPaintViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3C8604A1E44681B00F476AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C860491E44681B00F476AC /* main.m */; }; 11 | B3C8604D1E44681B00F476AC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C8604C1E44681B00F476AC /* AppDelegate.m */; }; 12 | B3C860501E44681B00F476AC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C8604F1E44681B00F476AC /* ViewController.m */; }; 13 | B3C860531E44681B00F476AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B3C860511E44681B00F476AC /* Main.storyboard */; }; 14 | B3C860551E44681B00F476AC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B3C860541E44681B00F476AC /* Assets.xcassets */; }; 15 | B3C860581E44681B00F476AC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B3C860561E44681B00F476AC /* LaunchScreen.storyboard */; }; 16 | B3C860631E44681B00F476AC /* LCPaintViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C860621E44681B00F476AC /* LCPaintViewDemoTests.m */; }; 17 | B3C8606E1E44681B00F476AC /* LCPaintViewDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C8606D1E44681B00F476AC /* LCPaintViewDemoUITests.m */; }; 18 | B3C860801E44682900F476AC /* LCBezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C8607D1E44682900F476AC /* LCBezierPath.m */; }; 19 | B3C860811E44682900F476AC /* LCPaintView.m in Sources */ = {isa = PBXBuildFile; fileRef = B3C8607F1E44682900F476AC /* LCPaintView.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | B3C8605F1E44681B00F476AC /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = B3C8603D1E44681B00F476AC /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = B3C860441E44681B00F476AC; 28 | remoteInfo = LCPaintViewDemo; 29 | }; 30 | B3C8606A1E44681B00F476AC /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = B3C8603D1E44681B00F476AC /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = B3C860441E44681B00F476AC; 35 | remoteInfo = LCPaintViewDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | B3C860451E44681B00F476AC /* LCPaintViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LCPaintViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | B3C860491E44681B00F476AC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | B3C8604B1E44681B00F476AC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | B3C8604C1E44681B00F476AC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | B3C8604E1E44681B00F476AC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | B3C8604F1E44681B00F476AC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | B3C860521E44681B00F476AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | B3C860541E44681B00F476AC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | B3C860571E44681B00F476AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | B3C860591E44681B00F476AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | B3C8605E1E44681B00F476AC /* LCPaintViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCPaintViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | B3C860621E44681B00F476AC /* LCPaintViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LCPaintViewDemoTests.m; sourceTree = ""; }; 52 | B3C860641E44681B00F476AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | B3C860691E44681B00F476AC /* LCPaintViewDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCPaintViewDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | B3C8606D1E44681B00F476AC /* LCPaintViewDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LCPaintViewDemoUITests.m; sourceTree = ""; }; 55 | B3C8606F1E44681B00F476AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | B3C8607C1E44682900F476AC /* LCBezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCBezierPath.h; sourceTree = ""; }; 57 | B3C8607D1E44682900F476AC /* LCBezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCBezierPath.m; sourceTree = ""; }; 58 | B3C8607E1E44682900F476AC /* LCPaintView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCPaintView.h; sourceTree = ""; }; 59 | B3C8607F1E44682900F476AC /* LCPaintView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCPaintView.m; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | B3C860421E44681B00F476AC /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | B3C8605B1E44681B00F476AC /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | B3C860661E44681B00F476AC /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | B3C8603C1E44681B00F476AC = { 88 | isa = PBXGroup; 89 | children = ( 90 | B3C8607B1E44682900F476AC /* LCPaintView */, 91 | B3C860471E44681B00F476AC /* LCPaintViewDemo */, 92 | B3C860611E44681B00F476AC /* LCPaintViewDemoTests */, 93 | B3C8606C1E44681B00F476AC /* LCPaintViewDemoUITests */, 94 | B3C860461E44681B00F476AC /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | B3C860461E44681B00F476AC /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | B3C860451E44681B00F476AC /* LCPaintViewDemo.app */, 102 | B3C8605E1E44681B00F476AC /* LCPaintViewDemoTests.xctest */, 103 | B3C860691E44681B00F476AC /* LCPaintViewDemoUITests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | B3C860471E44681B00F476AC /* LCPaintViewDemo */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | B3C8604B1E44681B00F476AC /* AppDelegate.h */, 112 | B3C8604C1E44681B00F476AC /* AppDelegate.m */, 113 | B3C8604E1E44681B00F476AC /* ViewController.h */, 114 | B3C8604F1E44681B00F476AC /* ViewController.m */, 115 | B3C860511E44681B00F476AC /* Main.storyboard */, 116 | B3C860541E44681B00F476AC /* Assets.xcassets */, 117 | B3C860561E44681B00F476AC /* LaunchScreen.storyboard */, 118 | B3C860591E44681B00F476AC /* Info.plist */, 119 | B3C860481E44681B00F476AC /* Supporting Files */, 120 | ); 121 | path = LCPaintViewDemo; 122 | sourceTree = ""; 123 | }; 124 | B3C860481E44681B00F476AC /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | B3C860491E44681B00F476AC /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | B3C860611E44681B00F476AC /* LCPaintViewDemoTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | B3C860621E44681B00F476AC /* LCPaintViewDemoTests.m */, 136 | B3C860641E44681B00F476AC /* Info.plist */, 137 | ); 138 | path = LCPaintViewDemoTests; 139 | sourceTree = ""; 140 | }; 141 | B3C8606C1E44681B00F476AC /* LCPaintViewDemoUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | B3C8606D1E44681B00F476AC /* LCPaintViewDemoUITests.m */, 145 | B3C8606F1E44681B00F476AC /* Info.plist */, 146 | ); 147 | path = LCPaintViewDemoUITests; 148 | sourceTree = ""; 149 | }; 150 | B3C8607B1E44682900F476AC /* LCPaintView */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | B3C8607E1E44682900F476AC /* LCPaintView.h */, 154 | B3C8607F1E44682900F476AC /* LCPaintView.m */, 155 | B3C8607C1E44682900F476AC /* LCBezierPath.h */, 156 | B3C8607D1E44682900F476AC /* LCBezierPath.m */, 157 | ); 158 | path = LCPaintView; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | B3C860441E44681B00F476AC /* LCPaintViewDemo */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = B3C860721E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemo" */; 167 | buildPhases = ( 168 | B3C860411E44681B00F476AC /* Sources */, 169 | B3C860421E44681B00F476AC /* Frameworks */, 170 | B3C860431E44681B00F476AC /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = LCPaintViewDemo; 177 | productName = LCPaintViewDemo; 178 | productReference = B3C860451E44681B00F476AC /* LCPaintViewDemo.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | B3C8605D1E44681B00F476AC /* LCPaintViewDemoTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = B3C860751E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemoTests" */; 184 | buildPhases = ( 185 | B3C8605A1E44681B00F476AC /* Sources */, 186 | B3C8605B1E44681B00F476AC /* Frameworks */, 187 | B3C8605C1E44681B00F476AC /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | B3C860601E44681B00F476AC /* PBXTargetDependency */, 193 | ); 194 | name = LCPaintViewDemoTests; 195 | productName = LCPaintViewDemoTests; 196 | productReference = B3C8605E1E44681B00F476AC /* LCPaintViewDemoTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | B3C860681E44681B00F476AC /* LCPaintViewDemoUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = B3C860781E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemoUITests" */; 202 | buildPhases = ( 203 | B3C860651E44681B00F476AC /* Sources */, 204 | B3C860661E44681B00F476AC /* Frameworks */, 205 | B3C860671E44681B00F476AC /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | B3C8606B1E44681B00F476AC /* PBXTargetDependency */, 211 | ); 212 | name = LCPaintViewDemoUITests; 213 | productName = LCPaintViewDemoUITests; 214 | productReference = B3C860691E44681B00F476AC /* LCPaintViewDemoUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | B3C8603D1E44681B00F476AC /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastUpgradeCheck = 0820; 224 | ORGANIZATIONNAME = Leo; 225 | TargetAttributes = { 226 | B3C860441E44681B00F476AC = { 227 | CreatedOnToolsVersion = 8.2.1; 228 | DevelopmentTeam = 4BZ2VM448J; 229 | ProvisioningStyle = Automatic; 230 | }; 231 | B3C8605D1E44681B00F476AC = { 232 | CreatedOnToolsVersion = 8.2.1; 233 | ProvisioningStyle = Automatic; 234 | TestTargetID = B3C860441E44681B00F476AC; 235 | }; 236 | B3C860681E44681B00F476AC = { 237 | CreatedOnToolsVersion = 8.2.1; 238 | ProvisioningStyle = Automatic; 239 | TestTargetID = B3C860441E44681B00F476AC; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = B3C860401E44681B00F476AC /* Build configuration list for PBXProject "LCPaintViewDemo" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = B3C8603C1E44681B00F476AC; 252 | productRefGroup = B3C860461E44681B00F476AC /* Products */; 253 | projectDirPath = ""; 254 | projectRoot = ""; 255 | targets = ( 256 | B3C860441E44681B00F476AC /* LCPaintViewDemo */, 257 | B3C8605D1E44681B00F476AC /* LCPaintViewDemoTests */, 258 | B3C860681E44681B00F476AC /* LCPaintViewDemoUITests */, 259 | ); 260 | }; 261 | /* End PBXProject section */ 262 | 263 | /* Begin PBXResourcesBuildPhase section */ 264 | B3C860431E44681B00F476AC /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | B3C860581E44681B00F476AC /* LaunchScreen.storyboard in Resources */, 269 | B3C860551E44681B00F476AC /* Assets.xcassets in Resources */, 270 | B3C860531E44681B00F476AC /* Main.storyboard in Resources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | B3C8605C1E44681B00F476AC /* Resources */ = { 275 | isa = PBXResourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | B3C860671E44681B00F476AC /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | /* End PBXResourcesBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | B3C860411E44681B00F476AC /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | B3C860501E44681B00F476AC /* ViewController.m in Sources */, 296 | B3C860811E44682900F476AC /* LCPaintView.m in Sources */, 297 | B3C8604D1E44681B00F476AC /* AppDelegate.m in Sources */, 298 | B3C860801E44682900F476AC /* LCBezierPath.m in Sources */, 299 | B3C8604A1E44681B00F476AC /* main.m in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | B3C8605A1E44681B00F476AC /* Sources */ = { 304 | isa = PBXSourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | B3C860631E44681B00F476AC /* LCPaintViewDemoTests.m in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | B3C860651E44681B00F476AC /* Sources */ = { 312 | isa = PBXSourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | B3C8606E1E44681B00F476AC /* LCPaintViewDemoUITests.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | /* End PBXSourcesBuildPhase section */ 320 | 321 | /* Begin PBXTargetDependency section */ 322 | B3C860601E44681B00F476AC /* PBXTargetDependency */ = { 323 | isa = PBXTargetDependency; 324 | target = B3C860441E44681B00F476AC /* LCPaintViewDemo */; 325 | targetProxy = B3C8605F1E44681B00F476AC /* PBXContainerItemProxy */; 326 | }; 327 | B3C8606B1E44681B00F476AC /* PBXTargetDependency */ = { 328 | isa = PBXTargetDependency; 329 | target = B3C860441E44681B00F476AC /* LCPaintViewDemo */; 330 | targetProxy = B3C8606A1E44681B00F476AC /* PBXContainerItemProxy */; 331 | }; 332 | /* End PBXTargetDependency section */ 333 | 334 | /* Begin PBXVariantGroup section */ 335 | B3C860511E44681B00F476AC /* Main.storyboard */ = { 336 | isa = PBXVariantGroup; 337 | children = ( 338 | B3C860521E44681B00F476AC /* Base */, 339 | ); 340 | name = Main.storyboard; 341 | sourceTree = ""; 342 | }; 343 | B3C860561E44681B00F476AC /* LaunchScreen.storyboard */ = { 344 | isa = PBXVariantGroup; 345 | children = ( 346 | B3C860571E44681B00F476AC /* Base */, 347 | ); 348 | name = LaunchScreen.storyboard; 349 | sourceTree = ""; 350 | }; 351 | /* End PBXVariantGroup section */ 352 | 353 | /* Begin XCBuildConfiguration section */ 354 | B3C860701E44681B00F476AC /* Debug */ = { 355 | isa = XCBuildConfiguration; 356 | buildSettings = { 357 | ALWAYS_SEARCH_USER_PATHS = NO; 358 | CLANG_ANALYZER_NONNULL = YES; 359 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 360 | CLANG_CXX_LIBRARY = "libc++"; 361 | CLANG_ENABLE_MODULES = YES; 362 | CLANG_ENABLE_OBJC_ARC = YES; 363 | CLANG_WARN_BOOL_CONVERSION = YES; 364 | CLANG_WARN_CONSTANT_CONVERSION = YES; 365 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 366 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INFINITE_RECURSION = YES; 370 | CLANG_WARN_INT_CONVERSION = YES; 371 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 372 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 376 | COPY_PHASE_STRIP = NO; 377 | DEBUG_INFORMATION_FORMAT = dwarf; 378 | ENABLE_STRICT_OBJC_MSGSEND = YES; 379 | ENABLE_TESTABILITY = YES; 380 | GCC_C_LANGUAGE_STANDARD = gnu99; 381 | GCC_DYNAMIC_NO_PIC = NO; 382 | GCC_NO_COMMON_BLOCKS = YES; 383 | GCC_OPTIMIZATION_LEVEL = 0; 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 389 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 390 | GCC_WARN_UNDECLARED_SELECTOR = YES; 391 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 392 | GCC_WARN_UNUSED_FUNCTION = YES; 393 | GCC_WARN_UNUSED_VARIABLE = YES; 394 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 395 | MTL_ENABLE_DEBUG_INFO = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | }; 400 | name = Debug; 401 | }; 402 | B3C860711E44681B00F476AC /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_SEARCH_USER_PATHS = NO; 406 | CLANG_ANALYZER_NONNULL = YES; 407 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 408 | CLANG_CXX_LIBRARY = "libc++"; 409 | CLANG_ENABLE_MODULES = YES; 410 | CLANG_ENABLE_OBJC_ARC = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 415 | CLANG_WARN_EMPTY_BODY = YES; 416 | CLANG_WARN_ENUM_CONVERSION = YES; 417 | CLANG_WARN_INFINITE_RECURSION = YES; 418 | CLANG_WARN_INT_CONVERSION = YES; 419 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 420 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 421 | CLANG_WARN_UNREACHABLE_CODE = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 424 | COPY_PHASE_STRIP = NO; 425 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 426 | ENABLE_NS_ASSERTIONS = NO; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 437 | MTL_ENABLE_DEBUG_INFO = NO; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | VALIDATE_PRODUCT = YES; 441 | }; 442 | name = Release; 443 | }; 444 | B3C860731E44681B00F476AC /* Debug */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 449 | DEVELOPMENT_TEAM = 4BZ2VM448J; 450 | INFOPLIST_FILE = LCPaintViewDemo/Info.plist; 451 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemo; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | }; 456 | name = Debug; 457 | }; 458 | B3C860741E44681B00F476AC /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 463 | DEVELOPMENT_TEAM = 4BZ2VM448J; 464 | INFOPLIST_FILE = LCPaintViewDemo/Info.plist; 465 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 467 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemo; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | }; 470 | name = Release; 471 | }; 472 | B3C860761E44681B00F476AC /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | BUNDLE_LOADER = "$(TEST_HOST)"; 476 | INFOPLIST_FILE = LCPaintViewDemoTests/Info.plist; 477 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 478 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemoTests; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCPaintViewDemo.app/LCPaintViewDemo"; 481 | }; 482 | name = Debug; 483 | }; 484 | B3C860771E44681B00F476AC /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | BUNDLE_LOADER = "$(TEST_HOST)"; 488 | INFOPLIST_FILE = LCPaintViewDemoTests/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemoTests; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCPaintViewDemo.app/LCPaintViewDemo"; 493 | }; 494 | name = Release; 495 | }; 496 | B3C860791E44681B00F476AC /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | INFOPLIST_FILE = LCPaintViewDemoUITests/Info.plist; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemoUITests; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | TEST_TARGET_NAME = LCPaintViewDemo; 504 | }; 505 | name = Debug; 506 | }; 507 | B3C8607A1E44681B00F476AC /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | INFOPLIST_FILE = LCPaintViewDemoUITests/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 512 | PRODUCT_BUNDLE_IDENTIFIER = me.leodev.LCPaintViewDemoUITests; 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | TEST_TARGET_NAME = LCPaintViewDemo; 515 | }; 516 | name = Release; 517 | }; 518 | /* End XCBuildConfiguration section */ 519 | 520 | /* Begin XCConfigurationList section */ 521 | B3C860401E44681B00F476AC /* Build configuration list for PBXProject "LCPaintViewDemo" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | B3C860701E44681B00F476AC /* Debug */, 525 | B3C860711E44681B00F476AC /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | B3C860721E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemo" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | B3C860731E44681B00F476AC /* Debug */, 534 | B3C860741E44681B00F476AC /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | }; 538 | B3C860751E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemoTests" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | B3C860761E44681B00F476AC /* Debug */, 542 | B3C860771E44681B00F476AC /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | }; 546 | B3C860781E44681B00F476AC /* Build configuration list for PBXNativeTarget "LCPaintViewDemoUITests" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | B3C860791E44681B00F476AC /* Debug */, 550 | B3C8607A1E44681B00F476AC /* Release */, 551 | ); 552 | defaultConfigurationIsVisible = 0; 553 | }; 554 | /* End XCConfigurationList section */ 555 | }; 556 | rootObject = B3C8603D1E44681B00F476AC /* Project object */; 557 | } 558 | -------------------------------------------------------------------------------- /LCPaintViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LCPaintViewDemo.xcodeproj/xcuserdata/Leo.xcuserdatad/xcschemes/LCPaintViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LCPaintViewDemo.xcodeproj/xcuserdata/Leo.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LCPaintViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B3C860441E44681B00F476AC 16 | 17 | primary 18 | 19 | 20 | B3C8605D1E44681B00F476AC 21 | 22 | primary 23 | 24 | 25 | B3C860681E44681B00F476AC 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LCPaintViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LCPaintViewDemo 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. 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 | -------------------------------------------------------------------------------- /LCPaintViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LCPaintViewDemo 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /LCPaintViewDemo/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 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /LCPaintViewDemo/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /LCPaintViewDemo/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 | -------------------------------------------------------------------------------- /LCPaintViewDemo/Base.lproj/Main.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 | 36 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /LCPaintViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarStyle 32 | UIStatusBarStyleDefault 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LCPaintViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LCPaintViewDemo 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LCPaintViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LCPaintViewDemo 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LCPaintView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, weak) LCPaintView *paintView; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.view.backgroundColor = [UIColor yellowColor]; 24 | 25 | CGSize screenSize = [UIScreen mainScreen].bounds.size; 26 | 27 | 28 | LCPaintView *paintView = ({ 29 | LCPaintView *paintView = [[LCPaintView alloc] init]; 30 | paintView.lineWidth = 5.0f; 31 | paintView.lineColor = [UIColor whiteColor]; 32 | paintView.frame = CGRectMake(0, 0, screenSize.width, screenSize.height); 33 | [self.view insertSubview:paintView atIndex:0]; 34 | self.paintView = paintView; 35 | }); 36 | 37 | if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0f) { 38 | __weak typeof(paintView) weakPaintView = paintView; 39 | [NSTimer scheduledTimerWithTimeInterval:5.0f repeats:NO block:^(NSTimer * _Nonnull timer) { 40 | __strong typeof(weakPaintView) strongPaintView = weakPaintView; 41 | 42 | strongPaintView.lineColor = [UIColor redColor]; 43 | }]; 44 | } 45 | } 46 | 47 | - (IBAction)onClear { 48 | [self.paintView clear]; 49 | } 50 | 51 | - (IBAction)onUndo { 52 | [self.paintView undo]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /LCPaintViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LCPaintViewDemo 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. 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 | -------------------------------------------------------------------------------- /LCPaintViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /LCPaintViewDemoTests/LCPaintViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LCPaintViewDemoTests.m 3 | // LCPaintViewDemoTests 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LCPaintViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LCPaintViewDemoTests 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 | -------------------------------------------------------------------------------- /LCPaintViewDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /LCPaintViewDemoUITests/LCPaintViewDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LCPaintViewDemoUITests.m 3 | // LCPaintViewDemoUITests 4 | // 5 | // Created by Leo on 03/02/2017. 6 | // Copyright © 2017 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LCPaintViewDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LCPaintViewDemoUITests 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2017 Leo (http://LeoDev.me) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LCPaintView 2 | 3 | [![Travis](https://img.shields.io/travis/iTofu/LCPaintView.svg?style=flat)](https://travis-ci.org/iTofu/LCPaintView) 4 | [![CocoaPods](https://img.shields.io/cocoapods/v/LCPaintView.svg)](http://cocoadocs.org/docsets/LCPaintView) 5 | [![CocoaPods](https://img.shields.io/cocoapods/l/LCPaintView.svg)](https://raw.githubusercontent.com/iTofu/LCPaintView/master/LICENSE) 6 | [![CocoaPods](https://img.shields.io/cocoapods/p/LCPaintView.svg)](http://cocoadocs.org/docsets/LCPaintView) 7 | [![LeoDev](https://img.shields.io/badge/blog-LeoDev.me-brightgreen.svg)](https://leodev.me) 8 | 9 | 🖌 Paint view for iOS. 10 | 11 | LCPaintView 12 | 13 | ``` 14 | In me the tiger sniffs the rose. 15 | 16 | 心有猛虎,细嗅蔷薇。 17 | ``` 18 | 19 | Welcome to visit my blog:https://LeoDev.me 20 | 21 | 22 | 23 | ## Introduction 24 | 25 | 🖌 Paint view for iOS. 26 | 27 | 28 | 29 | ## Installation 30 | 31 | ### CocoaPods 32 | 33 | LCPaintView is available on [CocoaPods](https://cocoapods.org/). Just add the following to your project Podfile: 34 | 35 | ```ruby 36 | pod "LCPaintView" # Podfile 37 | ``` 38 | 39 | ### Non-CocoaPods 40 | 41 | Just drag the LCPaintView folder into your project. 42 | 43 | 44 | 45 | ## Usage 46 | 47 | * Use by including the following import: 48 | 49 | ```objc 50 | #import "LCPaintView.h" 51 | ``` 52 | 53 | * Demo code: 54 | 55 | ```objc 56 | LCPaintView *paintView = ({ 57 | LCPaintView *paintView = [[LCPaintView alloc] init]; 58 | paintView.frame = CGRectMake(0, 0, screenSize.width, screenSize.height); 59 | [self.view insertSubview:paintView atIndex:0]; 60 | paintView; 61 | }); 62 | ``` 63 | 64 | * Custom: 65 | 66 | ```objc 67 | // Properties 68 | paintView.lineWidth = 10.0f; 69 | paintView.lineColor = [UIColor redColor]; 70 | 71 | // Methods 72 | [paintView clear]; 73 | [paintView undo]; 74 | ``` 75 | 76 | 77 | ## ChangeLog 78 | 79 | ### V 1.0.0 80 | 81 | * Initial Commit. 82 | 83 | 84 | 85 | ## Support 86 | 87 | * If you have any question, just [commit a issue](https://github.com/iTofu/LCPaintView/issues/new)! 88 | 89 | * Mail: `echo bGVvZGF4aWFAZ21haWwuY29tCg== | base64 -D` or `echo ZGV2dGlwQDE2My5jb20K | base64 -D` 90 | 91 | * Blog: http://LeoDev.me 92 | 93 | * Donations: 94 | 95 | * PayPal: 96 | 97 | [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=leodaxia@gmail.com&item_name=leodaxia@gmail.com) 98 | 99 | * Alipay or Wechat Pay: 100 | 101 | Donate with Alipay or Wechat Pay 102 | 103 | Please note: donation does not imply any type of service contract. 104 | 105 | 106 | ## License 107 | 108 | [MIT License](https://opensource.org/licenses/MIT) 109 | --------------------------------------------------------------------------------