├── .gitignore ├── LICENSE ├── PooCodeView.podspec ├── PooCodeView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── PooCodeView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── PooCodeView │ ├── PooCodeView.h │ └── PooCodeView.m ├── ViewController.h ├── ViewController.m └── main.m ├── PooCodeViewTests ├── Info.plist └── PooCodeViewTests.m ├── PooCodeViewUITests ├── Info.plist └── PooCodeViewUITests.m ├── README.md └── v1.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 HaRi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PooCodeView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "PooCodeView" 3 | s.version = "1.0.1" 4 | s.summary = "Graphical verification code, local check graphics verification code, random verification code, graphic verification, text verification.🌄" 5 | s.homepage = "https://github.com/xiaohange/PooCodeView" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.author = { "韩俊强" => "532167805@qq.com" } 8 | s.platform = :ios, "7.0" 9 | s.ios.deployment_target = "7.0" 10 | s.source = { :git => "https://github.com/xiaohange/PooCodeView.git", :tag => s.version.to_s } 11 | s.source_files = "PooCodeView/**/*.{h,m}" 12 | s.public_header_files = "PooCodeView/**/*.h" 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /PooCodeView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 472525DF1E49708F000B187F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 472525DE1E49708F000B187F /* main.m */; }; 11 | 472525E21E49708F000B187F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 472525E11E49708F000B187F /* AppDelegate.m */; }; 12 | 472525E51E49708F000B187F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 472525E41E49708F000B187F /* ViewController.m */; }; 13 | 472525E81E49708F000B187F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 472525E61E49708F000B187F /* Main.storyboard */; }; 14 | 472525EA1E49708F000B187F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 472525E91E49708F000B187F /* Assets.xcassets */; }; 15 | 472525ED1E49708F000B187F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 472525EB1E49708F000B187F /* LaunchScreen.storyboard */; }; 16 | 472525F81E49708F000B187F /* PooCodeViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 472525F71E49708F000B187F /* PooCodeViewTests.m */; }; 17 | 472526031E49708F000B187F /* PooCodeViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 472526021E49708F000B187F /* PooCodeViewUITests.m */; }; 18 | 472526131E49709F000B187F /* PooCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 472526121E49709F000B187F /* PooCodeView.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 472525F41E49708F000B187F /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 472525D21E49708F000B187F /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 472525D91E49708F000B187F; 27 | remoteInfo = PooCodeView; 28 | }; 29 | 472525FF1E49708F000B187F /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 472525D21E49708F000B187F /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 472525D91E49708F000B187F; 34 | remoteInfo = PooCodeView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 472525DA1E49708F000B187F /* PooCodeView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PooCodeView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 472525DE1E49708F000B187F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | 472525E01E49708F000B187F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 472525E11E49708F000B187F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 472525E31E49708F000B187F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | 472525E41E49708F000B187F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | 472525E71E49708F000B187F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 472525E91E49708F000B187F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 472525EC1E49708F000B187F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 472525EE1E49708F000B187F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 472525F31E49708F000B187F /* PooCodeViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PooCodeViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 472525F71E49708F000B187F /* PooCodeViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PooCodeViewTests.m; sourceTree = ""; }; 51 | 472525F91E49708F000B187F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 472525FE1E49708F000B187F /* PooCodeViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PooCodeViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 472526021E49708F000B187F /* PooCodeViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PooCodeViewUITests.m; sourceTree = ""; }; 54 | 472526041E49708F000B187F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 472526111E49709F000B187F /* PooCodeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PooCodeView.h; sourceTree = ""; }; 56 | 472526121E49709F000B187F /* PooCodeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PooCodeView.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 472525D71E49708F000B187F /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 472525F01E49708F000B187F /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 472525FB1E49708F000B187F /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 472525D11E49708F000B187F = { 85 | isa = PBXGroup; 86 | children = ( 87 | 472525DC1E49708F000B187F /* PooCodeView */, 88 | 472525F61E49708F000B187F /* PooCodeViewTests */, 89 | 472526011E49708F000B187F /* PooCodeViewUITests */, 90 | 472525DB1E49708F000B187F /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 472525DB1E49708F000B187F /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 472525DA1E49708F000B187F /* PooCodeView.app */, 98 | 472525F31E49708F000B187F /* PooCodeViewTests.xctest */, 99 | 472525FE1E49708F000B187F /* PooCodeViewUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 472525DC1E49708F000B187F /* PooCodeView */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 472526101E49709F000B187F /* PooCodeView */, 108 | 472525E01E49708F000B187F /* AppDelegate.h */, 109 | 472525E11E49708F000B187F /* AppDelegate.m */, 110 | 472525E31E49708F000B187F /* ViewController.h */, 111 | 472525E41E49708F000B187F /* ViewController.m */, 112 | 472525E61E49708F000B187F /* Main.storyboard */, 113 | 472525E91E49708F000B187F /* Assets.xcassets */, 114 | 472525EB1E49708F000B187F /* LaunchScreen.storyboard */, 115 | 472525EE1E49708F000B187F /* Info.plist */, 116 | 472525DD1E49708F000B187F /* Supporting Files */, 117 | ); 118 | path = PooCodeView; 119 | sourceTree = ""; 120 | }; 121 | 472525DD1E49708F000B187F /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 472525DE1E49708F000B187F /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | 472525F61E49708F000B187F /* PooCodeViewTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 472525F71E49708F000B187F /* PooCodeViewTests.m */, 133 | 472525F91E49708F000B187F /* Info.plist */, 134 | ); 135 | path = PooCodeViewTests; 136 | sourceTree = ""; 137 | }; 138 | 472526011E49708F000B187F /* PooCodeViewUITests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 472526021E49708F000B187F /* PooCodeViewUITests.m */, 142 | 472526041E49708F000B187F /* Info.plist */, 143 | ); 144 | path = PooCodeViewUITests; 145 | sourceTree = ""; 146 | }; 147 | 472526101E49709F000B187F /* PooCodeView */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 472526111E49709F000B187F /* PooCodeView.h */, 151 | 472526121E49709F000B187F /* PooCodeView.m */, 152 | ); 153 | path = PooCodeView; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 472525D91E49708F000B187F /* PooCodeView */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 472526071E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeView" */; 162 | buildPhases = ( 163 | 472525D61E49708F000B187F /* Sources */, 164 | 472525D71E49708F000B187F /* Frameworks */, 165 | 472525D81E49708F000B187F /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = PooCodeView; 172 | productName = PooCodeView; 173 | productReference = 472525DA1E49708F000B187F /* PooCodeView.app */; 174 | productType = "com.apple.product-type.application"; 175 | }; 176 | 472525F21E49708F000B187F /* PooCodeViewTests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 4725260A1E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeViewTests" */; 179 | buildPhases = ( 180 | 472525EF1E49708F000B187F /* Sources */, 181 | 472525F01E49708F000B187F /* Frameworks */, 182 | 472525F11E49708F000B187F /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 472525F51E49708F000B187F /* PBXTargetDependency */, 188 | ); 189 | name = PooCodeViewTests; 190 | productName = PooCodeViewTests; 191 | productReference = 472525F31E49708F000B187F /* PooCodeViewTests.xctest */; 192 | productType = "com.apple.product-type.bundle.unit-test"; 193 | }; 194 | 472525FD1E49708F000B187F /* PooCodeViewUITests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 4725260D1E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeViewUITests" */; 197 | buildPhases = ( 198 | 472525FA1E49708F000B187F /* Sources */, 199 | 472525FB1E49708F000B187F /* Frameworks */, 200 | 472525FC1E49708F000B187F /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 472526001E49708F000B187F /* PBXTargetDependency */, 206 | ); 207 | name = PooCodeViewUITests; 208 | productName = PooCodeViewUITests; 209 | productReference = 472525FE1E49708F000B187F /* PooCodeViewUITests.xctest */; 210 | productType = "com.apple.product-type.bundle.ui-testing"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 472525D21E49708F000B187F /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0820; 219 | ORGANIZATIONNAME = HaRi; 220 | TargetAttributes = { 221 | 472525D91E49708F000B187F = { 222 | CreatedOnToolsVersion = 8.2.1; 223 | DevelopmentTeam = WTB2BKP7UZ; 224 | ProvisioningStyle = Automatic; 225 | }; 226 | 472525F21E49708F000B187F = { 227 | CreatedOnToolsVersion = 8.2.1; 228 | DevelopmentTeam = WTB2BKP7UZ; 229 | ProvisioningStyle = Automatic; 230 | TestTargetID = 472525D91E49708F000B187F; 231 | }; 232 | 472525FD1E49708F000B187F = { 233 | CreatedOnToolsVersion = 8.2.1; 234 | DevelopmentTeam = WTB2BKP7UZ; 235 | ProvisioningStyle = Automatic; 236 | TestTargetID = 472525D91E49708F000B187F; 237 | }; 238 | }; 239 | }; 240 | buildConfigurationList = 472525D51E49708F000B187F /* Build configuration list for PBXProject "PooCodeView" */; 241 | compatibilityVersion = "Xcode 3.2"; 242 | developmentRegion = English; 243 | hasScannedForEncodings = 0; 244 | knownRegions = ( 245 | en, 246 | Base, 247 | ); 248 | mainGroup = 472525D11E49708F000B187F; 249 | productRefGroup = 472525DB1E49708F000B187F /* Products */; 250 | projectDirPath = ""; 251 | projectRoot = ""; 252 | targets = ( 253 | 472525D91E49708F000B187F /* PooCodeView */, 254 | 472525F21E49708F000B187F /* PooCodeViewTests */, 255 | 472525FD1E49708F000B187F /* PooCodeViewUITests */, 256 | ); 257 | }; 258 | /* End PBXProject section */ 259 | 260 | /* Begin PBXResourcesBuildPhase section */ 261 | 472525D81E49708F000B187F /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | 472525ED1E49708F000B187F /* LaunchScreen.storyboard in Resources */, 266 | 472525EA1E49708F000B187F /* Assets.xcassets in Resources */, 267 | 472525E81E49708F000B187F /* Main.storyboard in Resources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | 472525F11E49708F000B187F /* Resources */ = { 272 | isa = PBXResourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 472525FC1E49708F000B187F /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXResourcesBuildPhase section */ 286 | 287 | /* Begin PBXSourcesBuildPhase section */ 288 | 472525D61E49708F000B187F /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 472526131E49709F000B187F /* PooCodeView.m in Sources */, 293 | 472525E51E49708F000B187F /* ViewController.m in Sources */, 294 | 472525E21E49708F000B187F /* AppDelegate.m in Sources */, 295 | 472525DF1E49708F000B187F /* main.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | 472525EF1E49708F000B187F /* Sources */ = { 300 | isa = PBXSourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 472525F81E49708F000B187F /* PooCodeViewTests.m in Sources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 472525FA1E49708F000B187F /* Sources */ = { 308 | isa = PBXSourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | 472526031E49708F000B187F /* PooCodeViewUITests.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXSourcesBuildPhase section */ 316 | 317 | /* Begin PBXTargetDependency section */ 318 | 472525F51E49708F000B187F /* PBXTargetDependency */ = { 319 | isa = PBXTargetDependency; 320 | target = 472525D91E49708F000B187F /* PooCodeView */; 321 | targetProxy = 472525F41E49708F000B187F /* PBXContainerItemProxy */; 322 | }; 323 | 472526001E49708F000B187F /* PBXTargetDependency */ = { 324 | isa = PBXTargetDependency; 325 | target = 472525D91E49708F000B187F /* PooCodeView */; 326 | targetProxy = 472525FF1E49708F000B187F /* PBXContainerItemProxy */; 327 | }; 328 | /* End PBXTargetDependency section */ 329 | 330 | /* Begin PBXVariantGroup section */ 331 | 472525E61E49708F000B187F /* Main.storyboard */ = { 332 | isa = PBXVariantGroup; 333 | children = ( 334 | 472525E71E49708F000B187F /* Base */, 335 | ); 336 | name = Main.storyboard; 337 | sourceTree = ""; 338 | }; 339 | 472525EB1E49708F000B187F /* LaunchScreen.storyboard */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | 472525EC1E49708F000B187F /* Base */, 343 | ); 344 | name = LaunchScreen.storyboard; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXVariantGroup section */ 348 | 349 | /* Begin XCBuildConfiguration section */ 350 | 472526051E49708F000B187F /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | ALWAYS_SEARCH_USER_PATHS = NO; 354 | CLANG_ANALYZER_NONNULL = YES; 355 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 356 | CLANG_CXX_LIBRARY = "libc++"; 357 | CLANG_ENABLE_MODULES = YES; 358 | CLANG_ENABLE_OBJC_ARC = YES; 359 | CLANG_WARN_BOOL_CONVERSION = YES; 360 | CLANG_WARN_CONSTANT_CONVERSION = YES; 361 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 362 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 363 | CLANG_WARN_EMPTY_BODY = YES; 364 | CLANG_WARN_ENUM_CONVERSION = YES; 365 | CLANG_WARN_INFINITE_RECURSION = YES; 366 | CLANG_WARN_INT_CONVERSION = YES; 367 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 368 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 369 | CLANG_WARN_UNREACHABLE_CODE = YES; 370 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 371 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 372 | COPY_PHASE_STRIP = NO; 373 | DEBUG_INFORMATION_FORMAT = dwarf; 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | ENABLE_TESTABILITY = YES; 376 | GCC_C_LANGUAGE_STANDARD = gnu99; 377 | GCC_DYNAMIC_NO_PIC = NO; 378 | GCC_NO_COMMON_BLOCKS = YES; 379 | GCC_OPTIMIZATION_LEVEL = 0; 380 | GCC_PREPROCESSOR_DEFINITIONS = ( 381 | "DEBUG=1", 382 | "$(inherited)", 383 | ); 384 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 386 | GCC_WARN_UNDECLARED_SELECTOR = YES; 387 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 388 | GCC_WARN_UNUSED_FUNCTION = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 391 | MTL_ENABLE_DEBUG_INFO = YES; 392 | ONLY_ACTIVE_ARCH = YES; 393 | SDKROOT = iphoneos; 394 | TARGETED_DEVICE_FAMILY = "1,2"; 395 | }; 396 | name = Debug; 397 | }; 398 | 472526061E49708F000B187F /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ALWAYS_SEARCH_USER_PATHS = NO; 402 | CLANG_ANALYZER_NONNULL = YES; 403 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 404 | CLANG_CXX_LIBRARY = "libc++"; 405 | CLANG_ENABLE_MODULES = YES; 406 | CLANG_ENABLE_OBJC_ARC = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_CONSTANT_CONVERSION = YES; 409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 410 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 411 | CLANG_WARN_EMPTY_BODY = YES; 412 | CLANG_WARN_ENUM_CONVERSION = YES; 413 | CLANG_WARN_INFINITE_RECURSION = YES; 414 | CLANG_WARN_INT_CONVERSION = YES; 415 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 416 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 417 | CLANG_WARN_UNREACHABLE_CODE = YES; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 420 | COPY_PHASE_STRIP = NO; 421 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 422 | ENABLE_NS_ASSERTIONS = NO; 423 | ENABLE_STRICT_OBJC_MSGSEND = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu99; 425 | GCC_NO_COMMON_BLOCKS = YES; 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNDECLARED_SELECTOR = YES; 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 430 | GCC_WARN_UNUSED_FUNCTION = YES; 431 | GCC_WARN_UNUSED_VARIABLE = YES; 432 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 433 | MTL_ENABLE_DEBUG_INFO = NO; 434 | SDKROOT = iphoneos; 435 | TARGETED_DEVICE_FAMILY = "1,2"; 436 | VALIDATE_PRODUCT = YES; 437 | }; 438 | name = Release; 439 | }; 440 | 472526081E49708F000B187F /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 445 | INFOPLIST_FILE = PooCodeView/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeView; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | }; 450 | name = Debug; 451 | }; 452 | 472526091E49708F000B187F /* Release */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 456 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 457 | INFOPLIST_FILE = PooCodeView/Info.plist; 458 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 459 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeView; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | }; 462 | name = Release; 463 | }; 464 | 4725260B1E49708F000B187F /* Debug */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | BUNDLE_LOADER = "$(TEST_HOST)"; 468 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 469 | INFOPLIST_FILE = PooCodeViewTests/Info.plist; 470 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 471 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeViewTests; 472 | PRODUCT_NAME = "$(TARGET_NAME)"; 473 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PooCodeView.app/PooCodeView"; 474 | }; 475 | name = Debug; 476 | }; 477 | 4725260C1E49708F000B187F /* Release */ = { 478 | isa = XCBuildConfiguration; 479 | buildSettings = { 480 | BUNDLE_LOADER = "$(TEST_HOST)"; 481 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 482 | INFOPLIST_FILE = PooCodeViewTests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeViewTests; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PooCodeView.app/PooCodeView"; 487 | }; 488 | name = Release; 489 | }; 490 | 4725260E1E49708F000B187F /* Debug */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 494 | INFOPLIST_FILE = PooCodeViewUITests/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 496 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeViewUITests; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TEST_TARGET_NAME = PooCodeView; 499 | }; 500 | name = Debug; 501 | }; 502 | 4725260F1E49708F000B187F /* Release */ = { 503 | isa = XCBuildConfiguration; 504 | buildSettings = { 505 | DEVELOPMENT_TEAM = WTB2BKP7UZ; 506 | INFOPLIST_FILE = PooCodeViewUITests/Info.plist; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 508 | PRODUCT_BUNDLE_IDENTIFIER = HanJunqiang.PooCodeViewUITests; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | TEST_TARGET_NAME = PooCodeView; 511 | }; 512 | name = Release; 513 | }; 514 | /* End XCBuildConfiguration section */ 515 | 516 | /* Begin XCConfigurationList section */ 517 | 472525D51E49708F000B187F /* Build configuration list for PBXProject "PooCodeView" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 472526051E49708F000B187F /* Debug */, 521 | 472526061E49708F000B187F /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 472526071E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeView" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 472526081E49708F000B187F /* Debug */, 530 | 472526091E49708F000B187F /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | }; 534 | 4725260A1E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeViewTests" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | 4725260B1E49708F000B187F /* Debug */, 538 | 4725260C1E49708F000B187F /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | }; 542 | 4725260D1E49708F000B187F /* Build configuration list for PBXNativeTarget "PooCodeViewUITests" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | 4725260E1E49708F000B187F /* Debug */, 546 | 4725260F1E49708F000B187F /* Release */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | }; 550 | /* End XCConfigurationList section */ 551 | }; 552 | rootObject = 472525D21E49708F000B187F /* Project object */; 553 | } 554 | -------------------------------------------------------------------------------- /PooCodeView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PooCodeView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PooCodeView 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. 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 | -------------------------------------------------------------------------------- /PooCodeView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PooCodeView 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. 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 | -------------------------------------------------------------------------------- /PooCodeView/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 | } -------------------------------------------------------------------------------- /PooCodeView/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 | -------------------------------------------------------------------------------- /PooCodeView/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 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /PooCodeView/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 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PooCodeView/PooCodeView/PooCodeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PooCodeView.h 3 | // Code 4 | // 5 | // Created by 韩俊强 7/2/2016. 6 | // Copyright (c) 韩俊强 7/2/2016. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PooCodeView : UIView 12 | 13 | /** 14 | 初始化 15 | 16 | @param frame frame description 17 | @param changeArr 随机内容,字符数组如:@[@"a",@"F",@"A",@"1",@"0"]; 18 | @return return value description 19 | */ 20 | - (id)initWithFrame:(CGRect)frame andChangeArray:(NSArray *)changeArr; 21 | 22 | /** 23 | PooCodeView:1.随机内容(默认由0~9与26个大小写字母随机组合);2.文本颜色(默认黑色);3.字体大小(默认20);4.获取当前验证码等; 24 | */ 25 | @property (nonatomic, strong) UIColor *textColor; // 文本颜色 26 | @property (nonatomic, assign) int textSize; // 字体大小 27 | @property (nonatomic, retain) NSMutableString * changeString; // 验证码 28 | 29 | // 刷新随机验证码 30 | - (void)changeCode; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /PooCodeView/PooCodeView/PooCodeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PooCodeView.m 3 | // Code 4 | // 5 | // Created by 韩俊强 7/2/2016. 6 | // Copyright (c) 韩俊强 7/2/2016. All rights reserved. 7 | // 8 | 9 | #import "PooCodeView.h" 10 | #define RGBColor(r, g, b , a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a] 11 | #define RandColor(a) RGBColor(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255), a) 12 | @interface PooCodeView () 13 | 14 | @property (nonatomic, retain) NSArray *changeArray; // 随机内容 15 | 16 | 17 | @end 18 | 19 | @implementation PooCodeView 20 | 21 | @synthesize changeArray = _changeArray; 22 | 23 | @synthesize changeString = _changeString; 24 | 25 | 26 | - (id)initWithFrame:(CGRect)frame andChangeArray:(NSArray *)changeArr 27 | { 28 | self = [super initWithFrame:frame]; 29 | 30 | if (self) { 31 | 32 | self.backgroundColor = RandColor(0.2); 33 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)]; 34 | [self addGestureRecognizer:tap]; 35 | 36 | _changeArray = changeArr; 37 | 38 | [self change]; 39 | 40 | } 41 | return self; 42 | } 43 | 44 | - (void)tapClick:(UITapGestureRecognizer*)tap 45 | { 46 | [self changeCode]; 47 | } 48 | 49 | - (void)changeCode 50 | { 51 | [self change]; 52 | [self setNeedsDisplay]; 53 | } 54 | 55 | - (void)change 56 | { 57 | if (!self.changeArray.count) { 58 | self.changeArray = [[NSArray alloc] initWithObjects:@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o",@"p",@"q",@"r",@"s",@"t",@"u",@"v",@"w",@"x",@"y",@"z",nil]; 59 | } 60 | NSMutableString *getStr = [[NSMutableString alloc] initWithCapacity:5]; 61 | 62 | self.changeString = [[NSMutableString alloc] initWithCapacity:6]; 63 | for(NSInteger i = 0; i < 4; i++){ 64 | 65 | NSInteger index = arc4random() % ([self.changeArray count] - 1); 66 | getStr = [self.changeArray objectAtIndex:index]; 67 | 68 | self.changeString = (NSMutableString *)[self.changeString stringByAppendingString:getStr]; 69 | } 70 | } 71 | 72 | - (void)drawRect:(CGRect)rect 73 | { 74 | [super drawRect:rect]; 75 | 76 | UIColor *color = RandColor(0.5); 77 | [self setBackgroundColor:color]; 78 | 79 | NSString *text = [NSString stringWithFormat:@"%@",self.changeString]; 80 | CGSize cSize = [@"S" sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:_textSize>0?_textSize:20],NSForegroundColorAttributeName:_textColor?_textColor:[UIColor blackColor]}]; 81 | int width = rect.size.width / text.length - cSize.width; 82 | int height = rect.size.height - cSize.height; 83 | CGPoint point; 84 | 85 | float pX, pY; 86 | for (int i = 0; i < text.length; i++){ 87 | 88 | pX = arc4random() % width + rect.size.width / text.length * i; 89 | pY = arc4random() % height; 90 | point = CGPointMake(pX, pY); 91 | unichar c = [text characterAtIndex:i]; 92 | NSString *textC = [NSString stringWithFormat:@"%C", c]; 93 | [textC drawAtPoint:point withAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:_textSize>0?_textSize:20],NSForegroundColorAttributeName:_textColor?_textColor:[UIColor blackColor]}]; 94 | } 95 | 96 | CGContextRef context = UIGraphicsGetCurrentContext(); 97 | CGContextSetLineWidth(context, 1.0); 98 | 99 | for(int cout = 0; cout < 10; cout++){ 100 | 101 | color = RandColor(0.2); 102 | CGContextSetStrokeColorWithColor(context, [color CGColor]); 103 | pX = arc4random() % (int)rect.size.width; 104 | pY = arc4random() % (int)rect.size.height; 105 | CGContextMoveToPoint(context, pX, pY); 106 | pX = arc4random() % (int)rect.size.width; 107 | pY = arc4random() % (int)rect.size.height; 108 | CGContextAddLineToPoint(context, pX, pY); 109 | CGContextStrokePath(context); 110 | } 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /PooCodeView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PooCodeView 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /PooCodeView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PooCodeView 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "PooCodeView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) PooCodeView *pooCodeView; 15 | 16 | @property (weak, nonatomic) IBOutlet UITextField *myTextField; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | 26 | //1.默认 27 | _pooCodeView = [[PooCodeView alloc] initWithFrame:CGRectMake(10, 100, 120, 50) andChangeArray:nil]; 28 | [self.view addSubview:_pooCodeView]; 29 | 30 | //2.自定义 31 | NSArray *randomArr = @[@"H",@"j",@"q",@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9"]; 32 | _pooCodeView = [[PooCodeView alloc] initWithFrame:CGRectMake(140, 100, 120, 50) andChangeArray:randomArr]; 33 | 34 | //注意:文字高度不能大于poocodeview高度,否则crash 35 | _pooCodeView.textSize = 25; 36 | 37 | //不设置为blackColor 38 | _pooCodeView.textColor = [UIColor redColor]; 39 | 40 | [self.view addSubview:_pooCodeView]; 41 | } 42 | 43 | /** 验证:不区分字母大小写 **/ 44 | - (IBAction)judgeString:(id)sender 45 | { 46 | int result1 = [_pooCodeView.changeString compare:_myTextField.text options:NSCaseInsensitiveSearch]; 47 | 48 | if ((_pooCodeView.changeString.length == _myTextField.text.length ) && (result1 == 0)) { 49 | NSLog(@"匹配正确"); 50 | } 51 | else{ 52 | NSLog(@"验证码错误"); 53 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 54 | [_pooCodeView changeCode]; 55 | }); 56 | } 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /PooCodeView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PooCodeView 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. 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 | -------------------------------------------------------------------------------- /PooCodeViewTests/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 | -------------------------------------------------------------------------------- /PooCodeViewTests/PooCodeViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PooCodeViewTests.m 3 | // PooCodeViewTests 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PooCodeViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PooCodeViewTests 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 | -------------------------------------------------------------------------------- /PooCodeViewUITests/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 | -------------------------------------------------------------------------------- /PooCodeViewUITests/PooCodeViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PooCodeViewUITests.m 3 | // PooCodeViewUITests 4 | // 5 | // Created by 韩俊强 on 2017/2/7. 6 | // Copyright © 2017年 HaRi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PooCodeViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PooCodeViewUITests 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PooCodeView 2 | 图形验证码,本地校验图形验证码,🌄 随机验证码图文校验,图文校验,提升安全性,防止移动App验证码被盗刷,频繁登录等; 3 | 4 | ![](https://github.com/xiaohange/PooCodeView/blob/master/v1.gif?raw=true) 5 | 6 | ## 更新记录 7 | - 1.0.0 基础版本提交 1.0.0 (2017.07.24) 8 | 9 | ## Installation 10 | 11 | 1. Drag all source files under floder `PooCodeView` to your project. 12 | 2. pod "PooCodeView" 13 | 14 | ## Usage 15 | 16 | ``` 17 | #import "PooCodeView.h" 18 | @property (nonatomic, strong) PooCodeView *pooCodeView; 19 | ``` 20 | ``` 21 | //1.默认 22 | _pooCodeView = [[PooCodeView alloc] initWithFrame:CGRectMake(10, 100, 120, 50) andChangeArray:nil]; 23 | [self.view addSubview:_pooCodeView]; 24 | ``` 25 | 26 | ``` 27 | //2.自定义 28 | NSArray *randomArr = @[@"H",@"j",@"q",@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9"]; 29 | _pooCodeView = [[PooCodeView alloc] initWithFrame:CGRectMake(140, 100, 120, 50) andChangeArray:randomArr]; 30 | 31 | //注意:文字高度不能大于poocodeview高度,否则crash 32 | _pooCodeView.textSize = 25; 33 | 34 | //不设置为blackColor 35 | _pooCodeView.textColor = [UIColor redColor]; 36 | 37 | [self.view addSubview:_pooCodeView]; 38 | ``` 39 | ## Other 40 | [JQTumblrHud-高仿Tumblr App 加载指示器hud](https://github.com/xiaohange/JQTumblrHud) 41 | 42 | [JQScrollNumberLabel:仿tumblr热度滚动数字条数](https://github.com/xiaohange/JQScrollNumberLabel) 43 | 44 | [TumblrLikeAnimView-仿Tumblr点赞动画效果](https://github.com/xiaohange/TumblrLikeAnimView) 45 | 46 | [JQMenuPopView-仿Tumblr弹出视图发音频、视频、图片、文字的视图](https://github.com/xiaohange/JQMenuPopView) 47 | 48 | ## Star 49 | 50 | [CSDN博客](http://blog.csdn.net/qq_31810357) 51 | 52 | iOS开发者交流群:446310206 喜欢就❤️❤️❤️star一下吧!你的支持是我更新的动力! Love is every every every star! Your support is my renewed motivation! 53 | 54 | 55 | ## License 56 | 57 | This code is distributed under the terms and conditions of the [MIT license](LICENSE). -------------------------------------------------------------------------------- /v1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaohange/PooCodeView/1631febb650fdb9d12d8e4fea7302f648088131c/v1.gif --------------------------------------------------------------------------------