├── A_SupperDrawing.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── animax.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── animax.xcuserdatad │ └── xcschemes │ ├── A_SupperDrawing.xcscheme │ └── xcschememanagement.plist ├── A_SupperDrawing ├── A_DrawingBase.h ├── A_DrawingBase.m ├── A_SupperDrawing.h ├── A_SupperDrawing.m └── Info.plist ├── A_SupperDrawing_Demo ├── A_SupperDrawing_Demo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── animax.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── animax.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── A_SupperDrawing_Demo.xcscheme │ │ └── xcschememanagement.plist ├── A_SupperDrawing_Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── UITextField+ToNumber.h │ ├── UITextField+ToNumber.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── Screenshot │ └── record.gif └── README.md /A_SupperDrawing.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A90E070B1D4BF7AA0038DA3A /* A_DrawingBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A90E07091D4BF7AA0038DA3A /* A_DrawingBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | A90E070C1D4BF7AA0038DA3A /* A_DrawingBase.m in Sources */ = {isa = PBXBuildFile; fileRef = A90E070A1D4BF7AA0038DA3A /* A_DrawingBase.m */; }; 12 | A96F3F5F1D46AD5F00044329 /* A_SupperDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = A96F3F5D1D46AD5F00044329 /* A_SupperDrawing.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | A96F3F601D46AD5F00044329 /* A_SupperDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F3F5E1D46AD5F00044329 /* A_SupperDrawing.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | A90E07091D4BF7AA0038DA3A /* A_DrawingBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A_DrawingBase.h; sourceTree = ""; }; 18 | A90E070A1D4BF7AA0038DA3A /* A_DrawingBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A_DrawingBase.m; sourceTree = ""; }; 19 | A96F3F2D1D46A70500044329 /* A_SupperDrawing.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = A_SupperDrawing.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | A96F3F321D46A70500044329 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | A96F3F5D1D46AD5F00044329 /* A_SupperDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A_SupperDrawing.h; sourceTree = ""; }; 22 | A96F3F5E1D46AD5F00044329 /* A_SupperDrawing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A_SupperDrawing.m; sourceTree = ""; }; 23 | /* End PBXFileReference section */ 24 | 25 | /* Begin PBXFrameworksBuildPhase section */ 26 | A96F3F291D46A70500044329 /* Frameworks */ = { 27 | isa = PBXFrameworksBuildPhase; 28 | buildActionMask = 2147483647; 29 | files = ( 30 | ); 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | /* End PBXFrameworksBuildPhase section */ 34 | 35 | /* Begin PBXGroup section */ 36 | A96F3F231D46A70500044329 = { 37 | isa = PBXGroup; 38 | children = ( 39 | A96F3F2F1D46A70500044329 /* A_SupperDrawing */, 40 | A96F3F2E1D46A70500044329 /* Products */, 41 | ); 42 | sourceTree = ""; 43 | }; 44 | A96F3F2E1D46A70500044329 /* Products */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | A96F3F2D1D46A70500044329 /* A_SupperDrawing.framework */, 48 | ); 49 | name = Products; 50 | sourceTree = ""; 51 | }; 52 | A96F3F2F1D46A70500044329 /* A_SupperDrawing */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | A96F3F5D1D46AD5F00044329 /* A_SupperDrawing.h */, 56 | A96F3F5E1D46AD5F00044329 /* A_SupperDrawing.m */, 57 | A90E07091D4BF7AA0038DA3A /* A_DrawingBase.h */, 58 | A90E070A1D4BF7AA0038DA3A /* A_DrawingBase.m */, 59 | A96F3F321D46A70500044329 /* Info.plist */, 60 | ); 61 | path = A_SupperDrawing; 62 | sourceTree = ""; 63 | }; 64 | /* End PBXGroup section */ 65 | 66 | /* Begin PBXHeadersBuildPhase section */ 67 | A96F3F2A1D46A70500044329 /* Headers */ = { 68 | isa = PBXHeadersBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | A90E070B1D4BF7AA0038DA3A /* A_DrawingBase.h in Headers */, 72 | A96F3F5F1D46AD5F00044329 /* A_SupperDrawing.h in Headers */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXHeadersBuildPhase section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | A96F3F2C1D46A70500044329 /* A_SupperDrawing */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = A96F3F351D46A70500044329 /* Build configuration list for PBXNativeTarget "A_SupperDrawing" */; 82 | buildPhases = ( 83 | A96F3F281D46A70500044329 /* Sources */, 84 | A96F3F291D46A70500044329 /* Frameworks */, 85 | A96F3F2A1D46A70500044329 /* Headers */, 86 | A96F3F2B1D46A70500044329 /* Resources */, 87 | ); 88 | buildRules = ( 89 | ); 90 | dependencies = ( 91 | ); 92 | name = A_SupperDrawing; 93 | productName = A_SupperDrawing; 94 | productReference = A96F3F2D1D46A70500044329 /* A_SupperDrawing.framework */; 95 | productType = "com.apple.product-type.framework"; 96 | }; 97 | /* End PBXNativeTarget section */ 98 | 99 | /* Begin PBXProject section */ 100 | A96F3F241D46A70500044329 /* Project object */ = { 101 | isa = PBXProject; 102 | attributes = { 103 | LastUpgradeCheck = 0730; 104 | ORGANIZATIONNAME = Animax; 105 | TargetAttributes = { 106 | A96F3F2C1D46A70500044329 = { 107 | CreatedOnToolsVersion = 7.3.1; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = A96F3F271D46A70500044329 /* Build configuration list for PBXProject "A_SupperDrawing" */; 112 | compatibilityVersion = "Xcode 3.2"; 113 | developmentRegion = English; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | ); 118 | mainGroup = A96F3F231D46A70500044329; 119 | productRefGroup = A96F3F2E1D46A70500044329 /* Products */; 120 | projectDirPath = ""; 121 | projectRoot = ""; 122 | targets = ( 123 | A96F3F2C1D46A70500044329 /* A_SupperDrawing */, 124 | ); 125 | }; 126 | /* End PBXProject section */ 127 | 128 | /* Begin PBXResourcesBuildPhase section */ 129 | A96F3F2B1D46A70500044329 /* Resources */ = { 130 | isa = PBXResourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | A96F3F281D46A70500044329 /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | A96F3F601D46AD5F00044329 /* A_SupperDrawing.m in Sources */, 144 | A90E070C1D4BF7AA0038DA3A /* A_DrawingBase.m in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | A96F3F331D46A70500044329 /* Debug */ = { 152 | isa = XCBuildConfiguration; 153 | buildSettings = { 154 | ALWAYS_SEARCH_USER_PATHS = NO; 155 | CLANG_ANALYZER_NONNULL = YES; 156 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 157 | CLANG_CXX_LIBRARY = "libc++"; 158 | CLANG_ENABLE_MODULES = YES; 159 | CLANG_ENABLE_OBJC_ARC = YES; 160 | CLANG_WARN_BOOL_CONVERSION = YES; 161 | CLANG_WARN_CONSTANT_CONVERSION = YES; 162 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 163 | CLANG_WARN_EMPTY_BODY = YES; 164 | CLANG_WARN_ENUM_CONVERSION = YES; 165 | CLANG_WARN_INT_CONVERSION = YES; 166 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 167 | CLANG_WARN_UNREACHABLE_CODE = YES; 168 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 169 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 170 | COPY_PHASE_STRIP = NO; 171 | CURRENT_PROJECT_VERSION = 1; 172 | DEBUG_INFORMATION_FORMAT = dwarf; 173 | ENABLE_STRICT_OBJC_MSGSEND = YES; 174 | ENABLE_TESTABILITY = YES; 175 | GCC_C_LANGUAGE_STANDARD = gnu99; 176 | GCC_DYNAMIC_NO_PIC = NO; 177 | GCC_NO_COMMON_BLOCKS = YES; 178 | GCC_OPTIMIZATION_LEVEL = 0; 179 | GCC_PREPROCESSOR_DEFINITIONS = ( 180 | "DEBUG=1", 181 | "$(inherited)", 182 | ); 183 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 184 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 185 | GCC_WARN_UNDECLARED_SELECTOR = YES; 186 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 187 | GCC_WARN_UNUSED_FUNCTION = YES; 188 | GCC_WARN_UNUSED_VARIABLE = YES; 189 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 190 | MTL_ENABLE_DEBUG_INFO = YES; 191 | ONLY_ACTIVE_ARCH = YES; 192 | SDKROOT = iphoneos; 193 | TARGETED_DEVICE_FAMILY = "1,2"; 194 | VERSIONING_SYSTEM = "apple-generic"; 195 | VERSION_INFO_PREFIX = ""; 196 | }; 197 | name = Debug; 198 | }; 199 | A96F3F341D46A70500044329 /* Release */ = { 200 | isa = XCBuildConfiguration; 201 | buildSettings = { 202 | ALWAYS_SEARCH_USER_PATHS = NO; 203 | CLANG_ANALYZER_NONNULL = YES; 204 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 205 | CLANG_CXX_LIBRARY = "libc++"; 206 | CLANG_ENABLE_MODULES = YES; 207 | CLANG_ENABLE_OBJC_ARC = YES; 208 | CLANG_WARN_BOOL_CONVERSION = YES; 209 | CLANG_WARN_CONSTANT_CONVERSION = YES; 210 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 211 | CLANG_WARN_EMPTY_BODY = YES; 212 | CLANG_WARN_ENUM_CONVERSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_UNREACHABLE_CODE = YES; 216 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 217 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 218 | COPY_PHASE_STRIP = NO; 219 | CURRENT_PROJECT_VERSION = 1; 220 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 221 | ENABLE_NS_ASSERTIONS = NO; 222 | ENABLE_STRICT_OBJC_MSGSEND = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_NO_COMMON_BLOCKS = YES; 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 232 | MTL_ENABLE_DEBUG_INFO = NO; 233 | SDKROOT = iphoneos; 234 | TARGETED_DEVICE_FAMILY = "1,2"; 235 | VALIDATE_PRODUCT = YES; 236 | VERSIONING_SYSTEM = "apple-generic"; 237 | VERSION_INFO_PREFIX = ""; 238 | }; 239 | name = Release; 240 | }; 241 | A96F3F361D46A70500044329 /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | DEFINES_MODULE = YES; 245 | DYLIB_COMPATIBILITY_VERSION = 1; 246 | DYLIB_CURRENT_VERSION = 1; 247 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 248 | INFOPLIST_FILE = A_SupperDrawing/Info.plist; 249 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 250 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 251 | PRODUCT_BUNDLE_IDENTIFIER = "com.animax.A-SupperDrawing"; 252 | PRODUCT_NAME = "$(TARGET_NAME)"; 253 | SKIP_INSTALL = YES; 254 | }; 255 | name = Debug; 256 | }; 257 | A96F3F371D46A70500044329 /* Release */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | DEFINES_MODULE = YES; 261 | DYLIB_COMPATIBILITY_VERSION = 1; 262 | DYLIB_CURRENT_VERSION = 1; 263 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 264 | INFOPLIST_FILE = A_SupperDrawing/Info.plist; 265 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 266 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 267 | PRODUCT_BUNDLE_IDENTIFIER = "com.animax.A-SupperDrawing"; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | SKIP_INSTALL = YES; 270 | }; 271 | name = Release; 272 | }; 273 | /* End XCBuildConfiguration section */ 274 | 275 | /* Begin XCConfigurationList section */ 276 | A96F3F271D46A70500044329 /* Build configuration list for PBXProject "A_SupperDrawing" */ = { 277 | isa = XCConfigurationList; 278 | buildConfigurations = ( 279 | A96F3F331D46A70500044329 /* Debug */, 280 | A96F3F341D46A70500044329 /* Release */, 281 | ); 282 | defaultConfigurationIsVisible = 0; 283 | defaultConfigurationName = Release; 284 | }; 285 | A96F3F351D46A70500044329 /* Build configuration list for PBXNativeTarget "A_SupperDrawing" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | A96F3F361D46A70500044329 /* Debug */, 289 | A96F3F371D46A70500044329 /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | /* End XCConfigurationList section */ 295 | }; 296 | rootObject = A96F3F241D46A70500044329 /* Project object */; 297 | } 298 | -------------------------------------------------------------------------------- /A_SupperDrawing.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /A_SupperDrawing.xcodeproj/project.xcworkspace/xcuserdata/animax.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Animaxx/A-SupperDrawing/b07e446a2ccfcad853a818d3a15d649c87104581/A_SupperDrawing.xcodeproj/project.xcworkspace/xcuserdata/animax.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /A_SupperDrawing.xcodeproj/xcuserdata/animax.xcuserdatad/xcschemes/A_SupperDrawing.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /A_SupperDrawing.xcodeproj/xcuserdata/animax.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | A_SupperDrawing.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A96F3F2C1D46A70500044329 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /A_SupperDrawing/A_DrawingBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // A_DrawingBase.h 3 | // A_SupperDrawing 4 | // 5 | // Created by Animax Deng on 7/29/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @protocol A_DrawingProtocol 13 | 14 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision lineWidth:(float)lineWidth; 15 | 16 | @end 17 | 18 | @interface A_DrawingBase : NSObject 19 | 20 | /** 21 | * Generate the path base on params which set 22 | * 23 | * @param size Height and Width of the canvas 24 | * @param zoomRate The Rate of zoom, [0~1.0], default 0.84 25 | * @param precision Bigger number of precision will be more perfect of the path, [100.0~10000.0], defaule 6000 26 | * @param lineWidth The width of the line, default 1.0 27 | * 28 | * @return UIBezierPath 29 | */ 30 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision 31 | lineWidth:(float)lineWidth; 32 | 33 | /** 34 | * Generate the UIImage base on params which set 35 | * 36 | * @param size Height and Width of the canvas 37 | * @param zoomRate The Rate of zoom, [0~1.0], default 0.84 38 | * @param precision Bigger number of precision will be more perfect of the path, [100.0~10000.0], defaule 6000 39 | * @param lineWidth The width of the line, default 1.0 40 | * @param color Color of the line. 41 | * 42 | * @return UIImage 43 | */ 44 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision 45 | lineWidth:(float)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 46 | 47 | #pragma mark - extra helping functions 48 | - (UIBezierPath *)generatePathWithSize:(double)size; 49 | - (UIBezierPath *)generatePathWithSize:(double)size lineWidth:(float)lineWidth; 50 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate; 51 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(float)lineWidth; 52 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision; 53 | - (UIBezierPath *)generatePathWithSize:(double)size precision:(double)precision lineWidth:(float)lineWidth; 54 | 55 | - (UIImage *)generateImageWithSize:(double)size; 56 | - (UIImage *)generateImageWithSize:(double)size fillColor:(UIColor *)fillColor; 57 | - (UIImage *)generateImageWithSize:(double)size lineColor:(UIColor *)lineColor; 58 | - (UIImage *)generateImageWithSize:(double)size lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 59 | - (UIImage *)generateImageWithSize:(double)size lineWidth:(double)lineWidth; 60 | - (UIImage *)generateImageWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor; 61 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate; 62 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor; 63 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 64 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 65 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate fillColor:(UIColor *)fillColor; 66 | 67 | - (CAShapeLayer *)generateLayerWithSize:(double)size; 68 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineColor:(UIColor *)lineColor; 69 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth; 70 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor; 71 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 72 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate; 73 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineColor:(UIColor *)lineColor; 74 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor; 75 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /A_SupperDrawing/A_DrawingBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // A_DrawingBase.m 3 | // A_SupperDrawing 4 | // 5 | // Created by Animax Deng on 7/29/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import "A_DrawingBase.h" 10 | #include 11 | 12 | @implementation A_DrawingBase 13 | 14 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision lineWidth:(float)lineWidth { 15 | return [UIBezierPath bezierPath]; 16 | } 17 | 18 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision 19 | lineWidth:(float)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 20 | CGFloat deviceScale = [UIScreen mainScreen].scale; 21 | 22 | UIBezierPath *path = [self generatePathWithSize:size zoomRate:zoomRate precision:precision lineWidth:lineWidth]; 23 | 24 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(size, size), false, deviceScale); 25 | 26 | CGContextRef context = UIGraphicsGetCurrentContext(); 27 | 28 | if (lineColor) { 29 | [lineColor setStroke]; 30 | } 31 | if (fillColor) { 32 | [fillColor setFill]; 33 | } 34 | [path stroke]; 35 | 36 | // Style of Join 37 | CGContextSetLineJoin(context, kCGLineJoinRound); 38 | CGContextSetLineCap (context, kCGLineCapRound); 39 | 40 | UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); 41 | 42 | UIGraphicsEndImageContext(); 43 | return result; 44 | } 45 | 46 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision 47 | lineWidth:(float)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 48 | UIBezierPath *path = [self generatePathWithSize:size zoomRate:zoomRate precision:precision lineWidth:lineWidth]; 49 | CAShapeLayer *layer = [CAShapeLayer layer]; 50 | layer.path = path.CGPath; 51 | layer.strokeColor = [lineColor CGColor]; 52 | layer.fillColor = [fillColor CGColor]; 53 | return layer; 54 | } 55 | 56 | #pragma mark - Extra helping functions 57 | - (UIBezierPath *)generatePathWithSize:(double)size { 58 | return [self generatePathWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0]; 59 | } 60 | - (UIBezierPath *)generatePathWithSize:(double)size lineWidth:(float)lineWidth { 61 | return [self generatePathWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth]; 62 | } 63 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate { 64 | return [self generatePathWithSize:size zoomRate:zoomRate precision:6000 lineWidth:1.0]; 65 | } 66 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(float)lineWidth { 67 | return [self generatePathWithSize:size zoomRate:zoomRate precision:6000 lineWidth:lineWidth]; 68 | } 69 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision { 70 | return [self generatePathWithSize:size zoomRate:zoomRate precision:precision lineWidth:1.0]; 71 | } 72 | - (UIBezierPath *)generatePathWithSize:(double)size precision:(double)precision lineWidth:(float)lineWidth { 73 | return [self generatePathWithSize:size zoomRate:0.84 precision:precision lineWidth:lineWidth]; 74 | } 75 | 76 | - (UIImage *)generateImageWithSize:(double)size { 77 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0 lineColor:[UIColor blackColor] fillColor:nil]; 78 | } 79 | - (UIImage *)generateImageWithSize:(double)size lineColor:(UIColor *)lineColor { 80 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0 lineColor:lineColor fillColor:nil]; 81 | } 82 | - (UIImage *)generateImageWithSize:(double)size lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 83 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0 lineColor:lineColor fillColor:fillColor]; 84 | } 85 | - (UIImage *)generateImageWithSize:(double)size lineWidth:(double)lineWidth { 86 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth lineColor:[UIColor blackColor] fillColor:nil]; 87 | } 88 | - (UIImage *)generateImageWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor { 89 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:nil]; 90 | } 91 | - (UIImage *)generateImageWithSize:(double)size fillColor:(UIColor *)fillColor { 92 | return [self generateImageWithSize:size zoomRate:0.84 precision:6000 lineWidth:0.0 lineColor:nil fillColor:fillColor]; 93 | } 94 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate { 95 | return [self generateImageWithSize:size zoomRate:zoomRate precision:6000 lineWidth:1.0 lineColor:[UIColor blackColor] fillColor:nil]; 96 | } 97 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor { 98 | return [self generateImageWithSize:size zoomRate:zoomRate precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:nil]; 99 | } 100 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 101 | return [self generateImageWithSize:size zoomRate:zoomRate precision:6000 lineWidth:1.0 lineColor:lineColor fillColor:fillColor]; 102 | } 103 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 104 | return [self generateImageWithSize:size zoomRate:zoomRate precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:fillColor]; 105 | } 106 | - (UIImage *)generateImageWithSize:(double)size zoomRate:(double)zoomRate fillColor:(UIColor *)fillColor { 107 | return [self generateImageWithSize:size zoomRate:zoomRate precision:6000 lineWidth:0.0 lineColor:nil fillColor:fillColor]; 108 | } 109 | 110 | - (CAShapeLayer *)generateLayerWithSize:(double)size { 111 | return [self generateLayerWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0 lineColor:[UIColor blackColor] fillColor:[UIColor clearColor]]; 112 | } 113 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineColor:(UIColor *)lineColor { 114 | return [self generateLayerWithSize:size zoomRate:0.84 precision:6000 lineWidth:1.0 lineColor:lineColor fillColor:[UIColor clearColor]]; 115 | } 116 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth { 117 | return [self generateLayerWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth lineColor:[UIColor blackColor] fillColor:[UIColor clearColor]]; 118 | } 119 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor { 120 | return [self generateLayerWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:[UIColor clearColor]]; 121 | } 122 | - (CAShapeLayer *)generateLayerWithSize:(double)size lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 123 | return [self generateLayerWithSize:size zoomRate:0.84 precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:fillColor]; 124 | } 125 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate { 126 | return [self generateLayerWithSize:size zoomRate:zoomRate precision:6000 lineWidth:1.0 lineColor:[UIColor blackColor] fillColor:[UIColor clearColor]]; 127 | } 128 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineColor:(UIColor *)lineColor { 129 | return [self generateLayerWithSize:size zoomRate:zoomRate precision:6000 lineWidth:1.0 lineColor:lineColor fillColor:[UIColor clearColor]]; 130 | } 131 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor { 132 | return [self generateLayerWithSize:size zoomRate:zoomRate precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:[UIColor clearColor]]; 133 | } 134 | - (CAShapeLayer *)generateLayerWithSize:(double)size zoomRate:(double)zoomRate lineWidth:(double)lineWidth lineColor:(UIColor *)lineColor fillColor:(UIColor *)fillColor { 135 | return [self generateLayerWithSize:size zoomRate:zoomRate precision:6000 lineWidth:lineWidth lineColor:lineColor fillColor:fillColor]; 136 | } 137 | 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /A_SupperDrawing/A_SupperDrawing.h: -------------------------------------------------------------------------------- 1 | // 2 | // A_SupperDrawing.h 3 | // A_SupperDrawing 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | 10 | #import "A_DrawingBase.h" 11 | 12 | @interface A_SupperDrawing : A_DrawingBase 13 | 14 | // Formula parameters 15 | @property (nonatomic) double a; 16 | @property (nonatomic) double b; 17 | @property (nonatomic) double n1; 18 | @property (nonatomic) double n2; 19 | @property (nonatomic) double n3; 20 | @property (nonatomic) double y; 21 | @property (nonatomic) double z; 22 | 23 | // Extra paramters 24 | @property (nonatomic) BOOL reversal; 25 | 26 | + (A_SupperDrawing *)A_SupperDrawingWithA:(double)a b:(double)b 27 | n1:(double)n1 n2:(double)n2 n3:(double)n3 28 | y:(double)y z:(double)z; 29 | 30 | + (A_SupperDrawing *)A_SupperDrawingWithA:(double)a b:(double)b 31 | n1:(double)n1 n2:(double)n2 n3:(double)n3 32 | m:(double)m; 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /A_SupperDrawing/A_SupperDrawing.m: -------------------------------------------------------------------------------- 1 | // 2 | // A_SupperDrawing.m 3 | // A_SupperDrawing 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import "A_SupperDrawing.h" 10 | #include 11 | 12 | #define DEGREES_TO_RADIANS(degrees)((M_PI * degrees)/180) 13 | 14 | @implementation A_SupperDrawing { 15 | double _a; 16 | double _b; 17 | } 18 | 19 | @synthesize a = _a ,b = _b; 20 | 21 | #pragma mark - Init function 22 | + (A_SupperDrawing *)A_SupperDrawingWithA:(double)a b:(double)b 23 | n1:(double)n1 n2:(double)n2 n3:(double)n3 24 | y:(double)y z:(double)z { 25 | 26 | A_SupperDrawing *drawing = [[A_SupperDrawing alloc] init]; 27 | 28 | [drawing setA:a]; 29 | [drawing setB:b]; 30 | [drawing setN1:n1]; 31 | [drawing setN2:n2]; 32 | [drawing setN3:n3]; 33 | [drawing setY:y]; 34 | [drawing setZ:z]; 35 | [drawing setReversal:NO]; 36 | 37 | return drawing; 38 | } 39 | 40 | + (A_SupperDrawing *)A_SupperDrawingWithA:(double)a b:(double)b 41 | n1:(double)n1 n2:(double)n2 n3:(double)n3 42 | m:(double)m { 43 | return [A_SupperDrawing A_SupperDrawingWithA:a b:b n1:n1 n2:n2 n3:n3 y:m z:m]; 44 | } 45 | 46 | #pragma mark - Properties 47 | - (void)setA:(double)a { 48 | if (a != 0) _a = a; 49 | else _a = 1.0; 50 | } 51 | - (void)setB:(double)b { 52 | if (b != 0) _b = b; 53 | else _b = 1.0; 54 | } 55 | 56 | #pragma mark - Override the draw function 57 | - (UIBezierPath *)generatePathWithSize:(double)size zoomRate:(double)zoomRate precision:(double)precision lineWidth:(float)lineWidth { 58 | if (precision < 100.0) precision = 100.0l; 59 | else if (precision > 10000.0) precision = 10000.0; 60 | 61 | double piDouble = M_PI * 2.0; 62 | double frame = piDouble / precision; 63 | 64 | UIBezierPath *bezier = [UIBezierPath bezierPath]; 65 | 66 | [bezier moveToPoint:[self calculatePoint:frame size:size zoomRate:zoomRate]]; 67 | for (double t = frame; t <= piDouble; t += 0.001) { 68 | CGPoint p = [self calculatePoint:t size:size zoomRate:zoomRate]; 69 | [bezier addLineToPoint:p]; 70 | } 71 | 72 | [bezier closePath]; 73 | [bezier setLineWidth:lineWidth]; 74 | 75 | return bezier; 76 | } 77 | 78 | - (CGPoint)calculatePoint:(double)t size:(double)size zoomRate:(double)zoomRate { 79 | double screenCenterPoint = size * 0.5; 80 | double coordRate = size * zoomRate * 0.5; 81 | 82 | double raux = pow(fabs( cos((_y*t)/4) / _a ), _n2) + pow(fabs( sin((_z*t)/4) / _b ), _n3); 83 | double r = pow(raux, (1/_n1)); 84 | 85 | if (!_reversal && r != 0) { 86 | r = 1/r; 87 | } 88 | double pointX = r * cos(t) * coordRate + screenCenterPoint; 89 | double pointY = r * sin(t) * coordRate + screenCenterPoint; 90 | 91 | return CGPointMake(pointX, pointY); 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /A_SupperDrawing/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A925C1391D5A7871002B2506 /* UITextField+ToNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = A925C1381D5A7871002B2506 /* UITextField+ToNumber.m */; }; 11 | A96F3F461D46AAEF00044329 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F3F451D46AAEF00044329 /* main.m */; }; 12 | A96F3F491D46AAEF00044329 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F3F481D46AAEF00044329 /* AppDelegate.m */; }; 13 | A96F3F4C1D46AAEF00044329 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F3F4B1D46AAEF00044329 /* ViewController.m */; }; 14 | A96F3F4F1D46AAEF00044329 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A96F3F4D1D46AAEF00044329 /* Main.storyboard */; }; 15 | A96F3F511D46AAEF00044329 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A96F3F501D46AAEF00044329 /* Assets.xcassets */; }; 16 | A96F3F541D46AAEF00044329 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A96F3F521D46AAEF00044329 /* LaunchScreen.storyboard */; }; 17 | A96F3F671D46BE8B00044329 /* A_SupperDrawing.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A96F3F661D46BE7E00044329 /* A_SupperDrawing.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | A96F3F651D46BE7E00044329 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = A96F3F611D46BE7E00044329 /* A_SupperDrawing.xcodeproj */; 24 | proxyType = 2; 25 | remoteGlobalIDString = A96F3F2D1D46A70500044329; 26 | remoteInfo = A_SupperDrawing; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | A925C1371D5A7871002B2506 /* UITextField+ToNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+ToNumber.h"; sourceTree = ""; }; 32 | A925C1381D5A7871002B2506 /* UITextField+ToNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+ToNumber.m"; sourceTree = ""; }; 33 | A96F3F411D46AAEF00044329 /* A_SupperDrawing_Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = A_SupperDrawing_Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | A96F3F451D46AAEF00044329 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | A96F3F471D46AAEF00044329 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | A96F3F481D46AAEF00044329 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | A96F3F4A1D46AAEF00044329 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 38 | A96F3F4B1D46AAEF00044329 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 39 | A96F3F4E1D46AAEF00044329 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | A96F3F501D46AAEF00044329 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 41 | A96F3F531D46AAEF00044329 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 42 | A96F3F551D46AAEF00044329 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | A96F3F611D46BE7E00044329 /* A_SupperDrawing.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = A_SupperDrawing.xcodeproj; path = ../A_SupperDrawing.xcodeproj; sourceTree = ""; }; 44 | /* End PBXFileReference section */ 45 | 46 | /* Begin PBXFrameworksBuildPhase section */ 47 | A96F3F3E1D46AAEF00044329 /* Frameworks */ = { 48 | isa = PBXFrameworksBuildPhase; 49 | buildActionMask = 2147483647; 50 | files = ( 51 | A96F3F671D46BE8B00044329 /* A_SupperDrawing.framework in Frameworks */, 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | A96F3F381D46AAEF00044329 = { 59 | isa = PBXGroup; 60 | children = ( 61 | A96F3F611D46BE7E00044329 /* A_SupperDrawing.xcodeproj */, 62 | A96F3F431D46AAEF00044329 /* A_SupperDrawing_Demo */, 63 | A96F3F421D46AAEF00044329 /* Products */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | A96F3F421D46AAEF00044329 /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | A96F3F411D46AAEF00044329 /* A_SupperDrawing_Demo.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | A96F3F431D46AAEF00044329 /* A_SupperDrawing_Demo */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | A96F3F471D46AAEF00044329 /* AppDelegate.h */, 79 | A96F3F481D46AAEF00044329 /* AppDelegate.m */, 80 | A96F3F4A1D46AAEF00044329 /* ViewController.h */, 81 | A96F3F4B1D46AAEF00044329 /* ViewController.m */, 82 | A925C1371D5A7871002B2506 /* UITextField+ToNumber.h */, 83 | A925C1381D5A7871002B2506 /* UITextField+ToNumber.m */, 84 | A96F3F4D1D46AAEF00044329 /* Main.storyboard */, 85 | A96F3F501D46AAEF00044329 /* Assets.xcassets */, 86 | A96F3F521D46AAEF00044329 /* LaunchScreen.storyboard */, 87 | A96F3F551D46AAEF00044329 /* Info.plist */, 88 | A96F3F441D46AAEF00044329 /* Supporting Files */, 89 | ); 90 | path = A_SupperDrawing_Demo; 91 | sourceTree = ""; 92 | }; 93 | A96F3F441D46AAEF00044329 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | A96F3F451D46AAEF00044329 /* main.m */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | A96F3F621D46BE7E00044329 /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | A96F3F661D46BE7E00044329 /* A_SupperDrawing.framework */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | A96F3F401D46AAEF00044329 /* A_SupperDrawing_Demo */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = A96F3F581D46AAEF00044329 /* Build configuration list for PBXNativeTarget "A_SupperDrawing_Demo" */; 115 | buildPhases = ( 116 | A96F3F3D1D46AAEF00044329 /* Sources */, 117 | A96F3F3E1D46AAEF00044329 /* Frameworks */, 118 | A96F3F3F1D46AAEF00044329 /* Resources */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = A_SupperDrawing_Demo; 125 | productName = A_SupperDrawing_Demo; 126 | productReference = A96F3F411D46AAEF00044329 /* A_SupperDrawing_Demo.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | A96F3F391D46AAEF00044329 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastUpgradeCheck = 0730; 136 | ORGANIZATIONNAME = Animax; 137 | TargetAttributes = { 138 | A96F3F401D46AAEF00044329 = { 139 | CreatedOnToolsVersion = 7.3.1; 140 | }; 141 | }; 142 | }; 143 | buildConfigurationList = A96F3F3C1D46AAEF00044329 /* Build configuration list for PBXProject "A_SupperDrawing_Demo" */; 144 | compatibilityVersion = "Xcode 3.2"; 145 | developmentRegion = English; 146 | hasScannedForEncodings = 0; 147 | knownRegions = ( 148 | en, 149 | Base, 150 | ); 151 | mainGroup = A96F3F381D46AAEF00044329; 152 | productRefGroup = A96F3F421D46AAEF00044329 /* Products */; 153 | projectDirPath = ""; 154 | projectReferences = ( 155 | { 156 | ProductGroup = A96F3F621D46BE7E00044329 /* Products */; 157 | ProjectRef = A96F3F611D46BE7E00044329 /* A_SupperDrawing.xcodeproj */; 158 | }, 159 | ); 160 | projectRoot = ""; 161 | targets = ( 162 | A96F3F401D46AAEF00044329 /* A_SupperDrawing_Demo */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXReferenceProxy section */ 168 | A96F3F661D46BE7E00044329 /* A_SupperDrawing.framework */ = { 169 | isa = PBXReferenceProxy; 170 | fileType = wrapper.framework; 171 | path = A_SupperDrawing.framework; 172 | remoteRef = A96F3F651D46BE7E00044329 /* PBXContainerItemProxy */; 173 | sourceTree = BUILT_PRODUCTS_DIR; 174 | }; 175 | /* End PBXReferenceProxy section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | A96F3F3F1D46AAEF00044329 /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | A96F3F541D46AAEF00044329 /* LaunchScreen.storyboard in Resources */, 183 | A96F3F511D46AAEF00044329 /* Assets.xcassets in Resources */, 184 | A96F3F4F1D46AAEF00044329 /* Main.storyboard in Resources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXResourcesBuildPhase section */ 189 | 190 | /* Begin PBXSourcesBuildPhase section */ 191 | A96F3F3D1D46AAEF00044329 /* Sources */ = { 192 | isa = PBXSourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | A96F3F4C1D46AAEF00044329 /* ViewController.m in Sources */, 196 | A96F3F491D46AAEF00044329 /* AppDelegate.m in Sources */, 197 | A96F3F461D46AAEF00044329 /* main.m in Sources */, 198 | A925C1391D5A7871002B2506 /* UITextField+ToNumber.m in Sources */, 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXSourcesBuildPhase section */ 203 | 204 | /* Begin PBXVariantGroup section */ 205 | A96F3F4D1D46AAEF00044329 /* Main.storyboard */ = { 206 | isa = PBXVariantGroup; 207 | children = ( 208 | A96F3F4E1D46AAEF00044329 /* Base */, 209 | ); 210 | name = Main.storyboard; 211 | sourceTree = ""; 212 | }; 213 | A96F3F521D46AAEF00044329 /* LaunchScreen.storyboard */ = { 214 | isa = PBXVariantGroup; 215 | children = ( 216 | A96F3F531D46AAEF00044329 /* Base */, 217 | ); 218 | name = LaunchScreen.storyboard; 219 | sourceTree = ""; 220 | }; 221 | /* End PBXVariantGroup section */ 222 | 223 | /* Begin XCBuildConfiguration section */ 224 | A96F3F561D46AAEF00044329 /* Debug */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ALWAYS_SEARCH_USER_PATHS = NO; 228 | CLANG_ANALYZER_NONNULL = YES; 229 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 230 | CLANG_CXX_LIBRARY = "libc++"; 231 | CLANG_ENABLE_MODULES = YES; 232 | CLANG_ENABLE_OBJC_ARC = YES; 233 | CLANG_WARN_BOOL_CONVERSION = YES; 234 | CLANG_WARN_CONSTANT_CONVERSION = YES; 235 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 236 | CLANG_WARN_EMPTY_BODY = YES; 237 | CLANG_WARN_ENUM_CONVERSION = YES; 238 | CLANG_WARN_INT_CONVERSION = YES; 239 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 240 | CLANG_WARN_UNREACHABLE_CODE = YES; 241 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 242 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 243 | COPY_PHASE_STRIP = NO; 244 | DEBUG_INFORMATION_FORMAT = dwarf; 245 | ENABLE_STRICT_OBJC_MSGSEND = YES; 246 | ENABLE_TESTABILITY = YES; 247 | GCC_C_LANGUAGE_STANDARD = gnu99; 248 | GCC_DYNAMIC_NO_PIC = NO; 249 | GCC_NO_COMMON_BLOCKS = YES; 250 | GCC_OPTIMIZATION_LEVEL = 0; 251 | GCC_PREPROCESSOR_DEFINITIONS = ( 252 | "DEBUG=1", 253 | "$(inherited)", 254 | ); 255 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 256 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 257 | GCC_WARN_UNDECLARED_SELECTOR = YES; 258 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 259 | GCC_WARN_UNUSED_FUNCTION = YES; 260 | GCC_WARN_UNUSED_VARIABLE = YES; 261 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 262 | MTL_ENABLE_DEBUG_INFO = YES; 263 | ONLY_ACTIVE_ARCH = YES; 264 | SDKROOT = iphoneos; 265 | TARGETED_DEVICE_FAMILY = "1,2"; 266 | }; 267 | name = Debug; 268 | }; 269 | A96F3F571D46AAEF00044329 /* Release */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ALWAYS_SEARCH_USER_PATHS = NO; 273 | CLANG_ANALYZER_NONNULL = YES; 274 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 275 | CLANG_CXX_LIBRARY = "libc++"; 276 | CLANG_ENABLE_MODULES = YES; 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | CLANG_WARN_BOOL_CONVERSION = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INT_CONVERSION = YES; 284 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Release; 307 | }; 308 | A96F3F591D46AAEF00044329 /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 312 | INFOPLIST_FILE = A_SupperDrawing_Demo/Info.plist; 313 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 314 | PRODUCT_BUNDLE_IDENTIFIER = "com.animax.A-SupperDrawing-Demo"; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | }; 317 | name = Debug; 318 | }; 319 | A96F3F5A1D46AAEF00044329 /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | INFOPLIST_FILE = A_SupperDrawing_Demo/Info.plist; 324 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 325 | PRODUCT_BUNDLE_IDENTIFIER = "com.animax.A-SupperDrawing-Demo"; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | A96F3F3C1D46AAEF00044329 /* Build configuration list for PBXProject "A_SupperDrawing_Demo" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | A96F3F561D46AAEF00044329 /* Debug */, 337 | A96F3F571D46AAEF00044329 /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | A96F3F581D46AAEF00044329 /* Build configuration list for PBXNativeTarget "A_SupperDrawing_Demo" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | A96F3F591D46AAEF00044329 /* Debug */, 346 | A96F3F5A1D46AAEF00044329 /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | }; 353 | rootObject = A96F3F391D46AAEF00044329 /* Project object */; 354 | } 355 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/project.xcworkspace/xcuserdata/animax.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Animaxx/A-SupperDrawing/b07e446a2ccfcad853a818d3a15d649c87104581/A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/project.xcworkspace/xcuserdata/animax.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/xcuserdata/animax.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/xcuserdata/animax.xcuserdatad/xcschemes/A_SupperDrawing_Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo.xcodeproj/xcuserdata/animax.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | A_SupperDrawing_Demo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A96F3F401D46AAEF00044329 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. 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 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. 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 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/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 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 41 | 47 | 53 | 59 | 65 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 143 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 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 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/UITextField+ToNumber.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+ToNumber.h 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 8/9/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITextField (ToNumber) 12 | 13 | - (double)toDouble; 14 | - (void)setRandom:(double)start end:(double)end; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/UITextField+ToNumber.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+ToNumber.m 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 8/9/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import "UITextField+ToNumber.h" 10 | 11 | @implementation UITextField (ToNumber) 12 | 13 | - (double)toDouble { 14 | if (self.text && self.text.length > 0) { 15 | return [self.text doubleValue]; 16 | } else { 17 | return 1.0; 18 | } 19 | } 20 | - (void)setRandom:(double)start end:(double)end { 21 | double s = start * 10, e = end * 10; 22 | double r = s + arc4random_uniform(e - s + 1); 23 | r = r / 10.0f; 24 | [self setText:[NSString stringWithFormat:@"%.1f", r]]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "UITextField+ToNumber.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (weak, nonatomic) IBOutlet UIImageView *demoImageView; 16 | 17 | 18 | @end 19 | 20 | @implementation ViewController { 21 | CAShapeLayer *imageLayer; 22 | 23 | __weak IBOutlet UIButton *drawBtn; 24 | __weak IBOutlet UIButton *randomBtn; 25 | 26 | __weak IBOutlet UITextField *_aTxt; 27 | __weak IBOutlet UITextField *_bTxt; 28 | __weak IBOutlet UITextField *_n1Txt; 29 | __weak IBOutlet UITextField *_n2Txt; 30 | __weak IBOutlet UITextField *_n3Txt; 31 | __weak IBOutlet UITextField *_yTxt; 32 | __weak IBOutlet UITextField *_zTxt; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | 38 | drawBtn.layer.borderWidth = 0.5f; 39 | drawBtn.layer.borderColor = [UIColor blackColor].CGColor; 40 | 41 | randomBtn.layer.borderWidth = 0.5f; 42 | randomBtn.layer.borderColor = [UIColor blackColor].CGColor; 43 | } 44 | 45 | - (void)viewWillAppear:(BOOL)animated { 46 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShown:) name:UIKeyboardWillShowNotification object:nil]; 47 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHidden:) name:UIKeyboardWillHideNotification object:nil]; 48 | } 49 | - (void)viewWillDisappear:(BOOL)animated { 50 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; 51 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; 52 | } 53 | 54 | - (void)viewDidAppear:(BOOL)animated { 55 | [super viewDidAppear:animated]; 56 | 57 | [self drawPhotograph]; 58 | } 59 | 60 | - (void)keyboardShown:(NSNotification *)notification { 61 | [self.view setBounds:CGRectMake(0, 216, self.view.frame.size.width, self.view.frame.size.height)]; 62 | } 63 | - (void)keyboardHidden:(NSNotification *)notification { 64 | [self.view setBounds:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 65 | } 66 | 67 | - (void)drawPhotograph { 68 | [self.view endEditing:YES]; 69 | [drawBtn setEnabled:NO]; 70 | [randomBtn setEnabled:NO]; 71 | 72 | A_SupperDrawing *drawing = [A_SupperDrawing A_SupperDrawingWithA:[_aTxt toDouble] 73 | b:[_bTxt toDouble] 74 | n1:[_n1Txt toDouble] 75 | n2:[_n2Txt toDouble] 76 | n3:[_n3Txt toDouble] 77 | y:[_yTxt toDouble] 78 | z:[_zTxt toDouble]]; 79 | 80 | if (!imageLayer) { 81 | [CATransaction begin]; { 82 | [CATransaction setCompletionBlock:^{ 83 | [drawBtn setEnabled:YES]; 84 | [randomBtn setEnabled:YES]; 85 | }]; 86 | 87 | imageLayer = [drawing generateLayerWithSize:_demoImageView.frame.size.width zoomRate:0.5f]; 88 | [self.demoImageView.layer addSublayer:imageLayer]; 89 | 90 | CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 91 | pathAnimation.duration = 3.0; 92 | pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; 93 | pathAnimation.toValue = [NSNumber numberWithFloat:1.0f]; 94 | [imageLayer addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; 95 | 96 | imageLayer.strokeEnd = 1.0f; 97 | 98 | } [CATransaction commit]; 99 | } else { 100 | __block UIBezierPath *path = [drawing generatePathWithSize:_demoImageView.frame.size.width zoomRate:0.5f]; 101 | 102 | [CATransaction begin]; { 103 | [CATransaction setCompletionBlock:^{ 104 | imageLayer.path = path.CGPath; 105 | [imageLayer removeAllAnimations]; 106 | 107 | [drawBtn setEnabled:YES]; 108 | [randomBtn setEnabled:YES]; 109 | }]; 110 | 111 | CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; 112 | pathAnimation.duration = 1.2; 113 | pathAnimation.toValue = (__bridge id)imageLayer.path; 114 | pathAnimation.toValue = (__bridge id)path.CGPath; 115 | pathAnimation.removedOnCompletion = false; 116 | pathAnimation.fillMode = @"forwards"; 117 | [imageLayer addAnimation:pathAnimation forKey:@"pathAnimation"]; 118 | 119 | } [CATransaction commit]; 120 | } 121 | } 122 | 123 | - (IBAction)onClickDraw:(id)sender { 124 | [self drawPhotograph]; 125 | } 126 | - (IBAction)onClickRandom:(id)sender { 127 | [_aTxt setRandom:0.1 end:10.0]; 128 | [_bTxt setRandom:0.1 end:10.0]; 129 | 130 | [_n1Txt setRandom:-10.0 end:10.0]; 131 | [_n2Txt setRandom:0.1 end:1.5]; 132 | [_n3Txt setRandom:0.1 end:1.5]; 133 | 134 | [_yTxt setRandom:1 end:100]; 135 | [_zTxt setRandom:1 end:100]; 136 | 137 | [self drawPhotograph]; 138 | } 139 | - (IBAction)onClickBackground:(id)sender { 140 | [self.view endEditing:YES]; 141 | } 142 | 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/A_SupperDrawing_Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // A_SupperDrawing_Demo 4 | // 5 | // Created by Animax Deng on 7/25/16. 6 | // Copyright © 2016 Animax. 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 | -------------------------------------------------------------------------------- /A_SupperDrawing_Demo/Screenshot/record.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Animaxx/A-SupperDrawing/b07e446a2ccfcad853a818d3a15d649c87104581/A_SupperDrawing_Demo/Screenshot/record.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A-SupperDrawing 2 | 3 | A CGPath, CAShapeLayer, and UIImage creator base on super-formula. 4 | 5 | **Example:** 6 | Please see the demo [project](https://github.com/Animaxx/A-SupperDrawing/tree/master/A_SupperDrawing_Demo). 7 | 8 | ![Demo GIF](https://raw.githubusercontent.com/Animaxx/A-SupperDrawing/master/A_SupperDrawing_Demo/Screenshot/record.gif) 9 | 10 | 11 | **TODO:** 12 | Support Fractal formula. 13 | --------------------------------------------------------------------------------