├── .gitignore ├── HZAnomalousButtonDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── HZAnomalousButtonDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── HZAnomalousButton.h ├── HZAnomalousButton.m ├── Info.plist ├── ViewController.h ├── ViewController.m ├── main.m └── model.PNG ├── HZAnomalousButtonDemoTests ├── HZAnomalousButtonDemoTests.m └── Info.plist ├── HZAnomalousButtonDemoUITests ├── HZAnomalousButtonDemoUITests.m └── Info.plist ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0324FBF620E5BF8D0053ABED /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FBF520E5BF8D0053ABED /* AppDelegate.m */; }; 11 | 0324FBF920E5BF8D0053ABED /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FBF820E5BF8D0053ABED /* ViewController.m */; }; 12 | 0324FBFC20E5BF8D0053ABED /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0324FBFA20E5BF8D0053ABED /* Main.storyboard */; }; 13 | 0324FBFE20E5BF8F0053ABED /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0324FBFD20E5BF8F0053ABED /* Assets.xcassets */; }; 14 | 0324FC0120E5BF8F0053ABED /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0324FBFF20E5BF8F0053ABED /* LaunchScreen.storyboard */; }; 15 | 0324FC0420E5BF8F0053ABED /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FC0320E5BF8F0053ABED /* main.m */; }; 16 | 0324FC0E20E5BF8F0053ABED /* HZAnomalousButtonDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FC0D20E5BF8F0053ABED /* HZAnomalousButtonDemoTests.m */; }; 17 | 0324FC1920E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FC1820E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.m */; }; 18 | 0324FC2820E5BFBD0053ABED /* HZAnomalousButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0324FC2720E5BFBD0053ABED /* HZAnomalousButton.m */; }; 19 | 0324FC2A20E5C4330053ABED /* model.PNG in Resources */ = {isa = PBXBuildFile; fileRef = 0324FC2920E5C4330053ABED /* model.PNG */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 0324FC0A20E5BF8F0053ABED /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 0324FBE920E5BF8D0053ABED /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 0324FBF020E5BF8D0053ABED; 28 | remoteInfo = HZAnomalousButtonDemo; 29 | }; 30 | 0324FC1520E5BF8F0053ABED /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 0324FBE920E5BF8D0053ABED /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 0324FBF020E5BF8D0053ABED; 35 | remoteInfo = HZAnomalousButtonDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 0324FBF120E5BF8D0053ABED /* HZAnomalousButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HZAnomalousButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 0324FBF420E5BF8D0053ABED /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 0324FBF520E5BF8D0053ABED /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 0324FBF720E5BF8D0053ABED /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | 0324FBF820E5BF8D0053ABED /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | 0324FBFB20E5BF8D0053ABED /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 0324FBFD20E5BF8F0053ABED /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 0324FC0020E5BF8F0053ABED /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 0324FC0220E5BF8F0053ABED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 0324FC0320E5BF8F0053ABED /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 50 | 0324FC0920E5BF8F0053ABED /* HZAnomalousButtonDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HZAnomalousButtonDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 0324FC0D20E5BF8F0053ABED /* HZAnomalousButtonDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HZAnomalousButtonDemoTests.m; sourceTree = ""; }; 52 | 0324FC0F20E5BF8F0053ABED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 0324FC1420E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HZAnomalousButtonDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 0324FC1820E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HZAnomalousButtonDemoUITests.m; sourceTree = ""; }; 55 | 0324FC1A20E5BF8F0053ABED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 0324FC2620E5BFBD0053ABED /* HZAnomalousButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HZAnomalousButton.h; sourceTree = ""; }; 57 | 0324FC2720E5BFBD0053ABED /* HZAnomalousButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HZAnomalousButton.m; sourceTree = ""; }; 58 | 0324FC2920E5C4330053ABED /* model.PNG */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = model.PNG; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 0324FBEE20E5BF8D0053ABED /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 0324FC0620E5BF8F0053ABED /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 0324FC1120E5BF8F0053ABED /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 0324FBE820E5BF8D0053ABED = { 87 | isa = PBXGroup; 88 | children = ( 89 | 0324FBF320E5BF8D0053ABED /* HZAnomalousButtonDemo */, 90 | 0324FC0C20E5BF8F0053ABED /* HZAnomalousButtonDemoTests */, 91 | 0324FC1720E5BF8F0053ABED /* HZAnomalousButtonDemoUITests */, 92 | 0324FBF220E5BF8D0053ABED /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 0324FBF220E5BF8D0053ABED /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 0324FBF120E5BF8D0053ABED /* HZAnomalousButtonDemo.app */, 100 | 0324FC0920E5BF8F0053ABED /* HZAnomalousButtonDemoTests.xctest */, 101 | 0324FC1420E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 0324FBF320E5BF8D0053ABED /* HZAnomalousButtonDemo */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 0324FBF420E5BF8D0053ABED /* AppDelegate.h */, 110 | 0324FBF520E5BF8D0053ABED /* AppDelegate.m */, 111 | 0324FBF720E5BF8D0053ABED /* ViewController.h */, 112 | 0324FBF820E5BF8D0053ABED /* ViewController.m */, 113 | 0324FC2620E5BFBD0053ABED /* HZAnomalousButton.h */, 114 | 0324FC2720E5BFBD0053ABED /* HZAnomalousButton.m */, 115 | 0324FC2920E5C4330053ABED /* model.PNG */, 116 | 0324FBFA20E5BF8D0053ABED /* Main.storyboard */, 117 | 0324FBFD20E5BF8F0053ABED /* Assets.xcassets */, 118 | 0324FBFF20E5BF8F0053ABED /* LaunchScreen.storyboard */, 119 | 0324FC0220E5BF8F0053ABED /* Info.plist */, 120 | 0324FC0320E5BF8F0053ABED /* main.m */, 121 | ); 122 | path = HZAnomalousButtonDemo; 123 | sourceTree = ""; 124 | }; 125 | 0324FC0C20E5BF8F0053ABED /* HZAnomalousButtonDemoTests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 0324FC0D20E5BF8F0053ABED /* HZAnomalousButtonDemoTests.m */, 129 | 0324FC0F20E5BF8F0053ABED /* Info.plist */, 130 | ); 131 | path = HZAnomalousButtonDemoTests; 132 | sourceTree = ""; 133 | }; 134 | 0324FC1720E5BF8F0053ABED /* HZAnomalousButtonDemoUITests */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 0324FC1820E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.m */, 138 | 0324FC1A20E5BF8F0053ABED /* Info.plist */, 139 | ); 140 | path = HZAnomalousButtonDemoUITests; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 0324FBF020E5BF8D0053ABED /* HZAnomalousButtonDemo */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 0324FC1D20E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemo" */; 149 | buildPhases = ( 150 | 0324FBED20E5BF8D0053ABED /* Sources */, 151 | 0324FBEE20E5BF8D0053ABED /* Frameworks */, 152 | 0324FBEF20E5BF8D0053ABED /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = HZAnomalousButtonDemo; 159 | productName = HZAnomalousButtonDemo; 160 | productReference = 0324FBF120E5BF8D0053ABED /* HZAnomalousButtonDemo.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | 0324FC0820E5BF8F0053ABED /* HZAnomalousButtonDemoTests */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 0324FC2020E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemoTests" */; 166 | buildPhases = ( 167 | 0324FC0520E5BF8F0053ABED /* Sources */, 168 | 0324FC0620E5BF8F0053ABED /* Frameworks */, 169 | 0324FC0720E5BF8F0053ABED /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | 0324FC0B20E5BF8F0053ABED /* PBXTargetDependency */, 175 | ); 176 | name = HZAnomalousButtonDemoTests; 177 | productName = HZAnomalousButtonDemoTests; 178 | productReference = 0324FC0920E5BF8F0053ABED /* HZAnomalousButtonDemoTests.xctest */; 179 | productType = "com.apple.product-type.bundle.unit-test"; 180 | }; 181 | 0324FC1320E5BF8F0053ABED /* HZAnomalousButtonDemoUITests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 0324FC2320E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemoUITests" */; 184 | buildPhases = ( 185 | 0324FC1020E5BF8F0053ABED /* Sources */, 186 | 0324FC1120E5BF8F0053ABED /* Frameworks */, 187 | 0324FC1220E5BF8F0053ABED /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 0324FC1620E5BF8F0053ABED /* PBXTargetDependency */, 193 | ); 194 | name = HZAnomalousButtonDemoUITests; 195 | productName = HZAnomalousButtonDemoUITests; 196 | productReference = 0324FC1420E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.xctest */; 197 | productType = "com.apple.product-type.bundle.ui-testing"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 0324FBE920E5BF8D0053ABED /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastUpgradeCheck = 0940; 206 | ORGANIZATIONNAME = huazhuo; 207 | TargetAttributes = { 208 | 0324FBF020E5BF8D0053ABED = { 209 | CreatedOnToolsVersion = 9.4.1; 210 | }; 211 | 0324FC0820E5BF8F0053ABED = { 212 | CreatedOnToolsVersion = 9.4.1; 213 | TestTargetID = 0324FBF020E5BF8D0053ABED; 214 | }; 215 | 0324FC1320E5BF8F0053ABED = { 216 | CreatedOnToolsVersion = 9.4.1; 217 | TestTargetID = 0324FBF020E5BF8D0053ABED; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 0324FBEC20E5BF8D0053ABED /* Build configuration list for PBXProject "HZAnomalousButtonDemo" */; 222 | compatibilityVersion = "Xcode 9.3"; 223 | developmentRegion = en; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = 0324FBE820E5BF8D0053ABED; 230 | productRefGroup = 0324FBF220E5BF8D0053ABED /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 0324FBF020E5BF8D0053ABED /* HZAnomalousButtonDemo */, 235 | 0324FC0820E5BF8F0053ABED /* HZAnomalousButtonDemoTests */, 236 | 0324FC1320E5BF8F0053ABED /* HZAnomalousButtonDemoUITests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 0324FBEF20E5BF8D0053ABED /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 0324FC0120E5BF8F0053ABED /* LaunchScreen.storyboard in Resources */, 247 | 0324FC2A20E5C4330053ABED /* model.PNG in Resources */, 248 | 0324FBFE20E5BF8F0053ABED /* Assets.xcassets in Resources */, 249 | 0324FBFC20E5BF8D0053ABED /* Main.storyboard in Resources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | 0324FC0720E5BF8F0053ABED /* Resources */ = { 254 | isa = PBXResourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | 0324FC1220E5BF8F0053ABED /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXResourcesBuildPhase section */ 268 | 269 | /* Begin PBXSourcesBuildPhase section */ 270 | 0324FBED20E5BF8D0053ABED /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | 0324FBF920E5BF8D0053ABED /* ViewController.m in Sources */, 275 | 0324FC0420E5BF8F0053ABED /* main.m in Sources */, 276 | 0324FBF620E5BF8D0053ABED /* AppDelegate.m in Sources */, 277 | 0324FC2820E5BFBD0053ABED /* HZAnomalousButton.m in Sources */, 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | 0324FC0520E5BF8F0053ABED /* Sources */ = { 282 | isa = PBXSourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 0324FC0E20E5BF8F0053ABED /* HZAnomalousButtonDemoTests.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | 0324FC1020E5BF8F0053ABED /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 0324FC1920E5BF8F0053ABED /* HZAnomalousButtonDemoUITests.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXSourcesBuildPhase section */ 298 | 299 | /* Begin PBXTargetDependency section */ 300 | 0324FC0B20E5BF8F0053ABED /* PBXTargetDependency */ = { 301 | isa = PBXTargetDependency; 302 | target = 0324FBF020E5BF8D0053ABED /* HZAnomalousButtonDemo */; 303 | targetProxy = 0324FC0A20E5BF8F0053ABED /* PBXContainerItemProxy */; 304 | }; 305 | 0324FC1620E5BF8F0053ABED /* PBXTargetDependency */ = { 306 | isa = PBXTargetDependency; 307 | target = 0324FBF020E5BF8D0053ABED /* HZAnomalousButtonDemo */; 308 | targetProxy = 0324FC1520E5BF8F0053ABED /* PBXContainerItemProxy */; 309 | }; 310 | /* End PBXTargetDependency section */ 311 | 312 | /* Begin PBXVariantGroup section */ 313 | 0324FBFA20E5BF8D0053ABED /* Main.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 0324FBFB20E5BF8D0053ABED /* Base */, 317 | ); 318 | name = Main.storyboard; 319 | sourceTree = ""; 320 | }; 321 | 0324FBFF20E5BF8F0053ABED /* LaunchScreen.storyboard */ = { 322 | isa = PBXVariantGroup; 323 | children = ( 324 | 0324FC0020E5BF8F0053ABED /* Base */, 325 | ); 326 | name = LaunchScreen.storyboard; 327 | sourceTree = ""; 328 | }; 329 | /* End PBXVariantGroup section */ 330 | 331 | /* Begin XCBuildConfiguration section */ 332 | 0324FC1B20E5BF8F0053ABED /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_ENABLE_OBJC_WEAK = YES; 343 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_COMMA = YES; 346 | CLANG_WARN_CONSTANT_CONVERSION = YES; 347 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 348 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 349 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INFINITE_RECURSION = YES; 353 | CLANG_WARN_INT_CONVERSION = YES; 354 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 362 | CLANG_WARN_UNREACHABLE_CODE = YES; 363 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 364 | CODE_SIGN_IDENTITY = "iPhone Developer"; 365 | COPY_PHASE_STRIP = NO; 366 | DEBUG_INFORMATION_FORMAT = dwarf; 367 | ENABLE_STRICT_OBJC_MSGSEND = YES; 368 | ENABLE_TESTABILITY = YES; 369 | GCC_C_LANGUAGE_STANDARD = gnu11; 370 | GCC_DYNAMIC_NO_PIC = NO; 371 | GCC_NO_COMMON_BLOCKS = YES; 372 | GCC_OPTIMIZATION_LEVEL = 0; 373 | GCC_PREPROCESSOR_DEFINITIONS = ( 374 | "DEBUG=1", 375 | "$(inherited)", 376 | ); 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 384 | MTL_ENABLE_DEBUG_INFO = YES; 385 | ONLY_ACTIVE_ARCH = YES; 386 | SDKROOT = iphoneos; 387 | }; 388 | name = Debug; 389 | }; 390 | 0324FC1C20E5BF8F0053ABED /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ALWAYS_SEARCH_USER_PATHS = NO; 394 | CLANG_ANALYZER_NONNULL = YES; 395 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_ENABLE_OBJC_WEAK = YES; 401 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 402 | CLANG_WARN_BOOL_CONVERSION = YES; 403 | CLANG_WARN_COMMA = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 406 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 407 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 408 | CLANG_WARN_EMPTY_BODY = YES; 409 | CLANG_WARN_ENUM_CONVERSION = YES; 410 | CLANG_WARN_INFINITE_RECURSION = YES; 411 | CLANG_WARN_INT_CONVERSION = YES; 412 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 413 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 414 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 415 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 416 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 417 | CLANG_WARN_STRICT_PROTOTYPES = YES; 418 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 419 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 420 | CLANG_WARN_UNREACHABLE_CODE = YES; 421 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 422 | CODE_SIGN_IDENTITY = "iPhone Developer"; 423 | COPY_PHASE_STRIP = NO; 424 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 425 | ENABLE_NS_ASSERTIONS = NO; 426 | ENABLE_STRICT_OBJC_MSGSEND = YES; 427 | GCC_C_LANGUAGE_STANDARD = gnu11; 428 | GCC_NO_COMMON_BLOCKS = YES; 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 431 | GCC_WARN_UNDECLARED_SELECTOR = YES; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 436 | MTL_ENABLE_DEBUG_INFO = NO; 437 | SDKROOT = iphoneos; 438 | VALIDATE_PRODUCT = YES; 439 | }; 440 | name = Release; 441 | }; 442 | 0324FC1E20E5BF8F0053ABED /* Debug */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 446 | CODE_SIGN_STYLE = Automatic; 447 | DEVELOPMENT_TEAM = J36ZY42JY9; 448 | INFOPLIST_FILE = HZAnomalousButtonDemo/Info.plist; 449 | LD_RUNPATH_SEARCH_PATHS = ( 450 | "$(inherited)", 451 | "@executable_path/Frameworks", 452 | ); 453 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemo; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | TARGETED_DEVICE_FAMILY = "1,2"; 456 | }; 457 | name = Debug; 458 | }; 459 | 0324FC1F20E5BF8F0053ABED /* Release */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 463 | CODE_SIGN_STYLE = Automatic; 464 | DEVELOPMENT_TEAM = J36ZY42JY9; 465 | INFOPLIST_FILE = HZAnomalousButtonDemo/Info.plist; 466 | LD_RUNPATH_SEARCH_PATHS = ( 467 | "$(inherited)", 468 | "@executable_path/Frameworks", 469 | ); 470 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemo; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | TARGETED_DEVICE_FAMILY = "1,2"; 473 | }; 474 | name = Release; 475 | }; 476 | 0324FC2120E5BF8F0053ABED /* Debug */ = { 477 | isa = XCBuildConfiguration; 478 | buildSettings = { 479 | BUNDLE_LOADER = "$(TEST_HOST)"; 480 | CODE_SIGN_STYLE = Automatic; 481 | DEVELOPMENT_TEAM = J36ZY42JY9; 482 | INFOPLIST_FILE = HZAnomalousButtonDemoTests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = ( 484 | "$(inherited)", 485 | "@executable_path/Frameworks", 486 | "@loader_path/Frameworks", 487 | ); 488 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemoTests; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | TARGETED_DEVICE_FAMILY = "1,2"; 491 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HZAnomalousButtonDemo.app/HZAnomalousButtonDemo"; 492 | }; 493 | name = Debug; 494 | }; 495 | 0324FC2220E5BF8F0053ABED /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | BUNDLE_LOADER = "$(TEST_HOST)"; 499 | CODE_SIGN_STYLE = Automatic; 500 | DEVELOPMENT_TEAM = J36ZY42JY9; 501 | INFOPLIST_FILE = HZAnomalousButtonDemoTests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemoTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HZAnomalousButtonDemo.app/HZAnomalousButtonDemo"; 511 | }; 512 | name = Release; 513 | }; 514 | 0324FC2420E5BF8F0053ABED /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | CODE_SIGN_STYLE = Automatic; 518 | DEVELOPMENT_TEAM = J36ZY42JY9; 519 | INFOPLIST_FILE = HZAnomalousButtonDemoUITests/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "@executable_path/Frameworks", 523 | "@loader_path/Frameworks", 524 | ); 525 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemoUITests; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | TARGETED_DEVICE_FAMILY = "1,2"; 528 | TEST_TARGET_NAME = HZAnomalousButtonDemo; 529 | }; 530 | name = Debug; 531 | }; 532 | 0324FC2520E5BF8F0053ABED /* Release */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | CODE_SIGN_STYLE = Automatic; 536 | DEVELOPMENT_TEAM = J36ZY42JY9; 537 | INFOPLIST_FILE = HZAnomalousButtonDemoUITests/Info.plist; 538 | LD_RUNPATH_SEARCH_PATHS = ( 539 | "$(inherited)", 540 | "@executable_path/Frameworks", 541 | "@loader_path/Frameworks", 542 | ); 543 | PRODUCT_BUNDLE_IDENTIFIER = com.wowjoy.HZAnomalousButtonDemoUITests; 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | TARGETED_DEVICE_FAMILY = "1,2"; 546 | TEST_TARGET_NAME = HZAnomalousButtonDemo; 547 | }; 548 | name = Release; 549 | }; 550 | /* End XCBuildConfiguration section */ 551 | 552 | /* Begin XCConfigurationList section */ 553 | 0324FBEC20E5BF8D0053ABED /* Build configuration list for PBXProject "HZAnomalousButtonDemo" */ = { 554 | isa = XCConfigurationList; 555 | buildConfigurations = ( 556 | 0324FC1B20E5BF8F0053ABED /* Debug */, 557 | 0324FC1C20E5BF8F0053ABED /* Release */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | defaultConfigurationName = Release; 561 | }; 562 | 0324FC1D20E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemo" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 0324FC1E20E5BF8F0053ABED /* Debug */, 566 | 0324FC1F20E5BF8F0053ABED /* Release */, 567 | ); 568 | defaultConfigurationIsVisible = 0; 569 | defaultConfigurationName = Release; 570 | }; 571 | 0324FC2020E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemoTests" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 0324FC2120E5BF8F0053ABED /* Debug */, 575 | 0324FC2220E5BF8F0053ABED /* Release */, 576 | ); 577 | defaultConfigurationIsVisible = 0; 578 | defaultConfigurationName = Release; 579 | }; 580 | 0324FC2320E5BF8F0053ABED /* Build configuration list for PBXNativeTarget "HZAnomalousButtonDemoUITests" */ = { 581 | isa = XCConfigurationList; 582 | buildConfigurations = ( 583 | 0324FC2420E5BF8F0053ABED /* Debug */, 584 | 0324FC2520E5BF8F0053ABED /* Release */, 585 | ); 586 | defaultConfigurationIsVisible = 0; 587 | defaultConfigurationName = Release; 588 | }; 589 | /* End XCConfigurationList section */ 590 | }; 591 | rootObject = 0324FBE920E5BF8D0053ABED /* Project object */; 592 | } 593 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/HZAnomalousButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // HZAnomalousButton.h 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HZAnomalousButton : UIView 12 | @property (nonatomic, copy) void(^buttonClick)(void); 13 | - (instancetype)initWithFrame:(CGRect)frame laySetOriginArr:(NSArray *)laySetOriginArr; 14 | @end 15 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/HZAnomalousButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // HZAnomalousButton.m 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import "HZAnomalousButton.h" 10 | 11 | @interface HZAnomalousButton() 12 | 13 | @property (strong,nonatomic)CAShapeLayer * shapeLayer; 14 | @property (nonatomic, copy) NSArray *laySetOriginArr; 15 | @end 16 | 17 | @implementation HZAnomalousButton 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame laySetOriginArr:(NSArray *)laySetOriginArr { 20 | if (self = [super initWithFrame:frame]) { 21 | _laySetOriginArr = laySetOriginArr; 22 | [self setUp]; 23 | } 24 | return self; 25 | } 26 | 27 | -(void)setUp { 28 | self.shapeLayer = [CAShapeLayer layer]; 29 | 30 | // 31 | CGMutablePathRef path = CGPathCreateMutable(); 32 | // 33 | 34 | for (NSInteger i = 0; i < self.laySetOriginArr.count; i++) { 35 | NSValue *pointValue = self.laySetOriginArr[i]; 36 | CGPoint originPoint = pointValue.CGPointValue; 37 | 38 | if (i == 0) { 39 | CGPathMoveToPoint(path, nil,originPoint.x, originPoint.y); 40 | continue; 41 | } 42 | CGPathAddLineToPoint(path, nil,originPoint.x,originPoint.y); 43 | } 44 | 45 | // 46 | self.shapeLayer.path = path; 47 | 48 | // 49 | [self.layer setMask:self.shapeLayer]; 50 | self.userInteractionEnabled = YES; 51 | // 52 | UITapGestureRecognizer *tapClick = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick_Click)]; 53 | [self addGestureRecognizer:tapClick]; 54 | } 55 | 56 | - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ 57 | if (CGPathContainsPoint(self.shapeLayer.path, nil, point, true)) { 58 | return [super pointInside:point withEvent:event]; 59 | }else{ 60 | return false; 61 | } 62 | } 63 | 64 | -(void)tapClick_Click{ 65 | if (self.buttonClick) { 66 | self.buttonClick(); 67 | } 68 | } 69 | @end 70 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "HZAnomalousButton.h" 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | 23 | 24 | NSArray *laySetArr0 = @[[NSValue valueWithCGPoint:CGPointMake(0, 0)], 25 | [NSValue valueWithCGPoint:CGPointMake(UIScreen.mainScreen.bounds.size.width * 0.5 + 30, 0)], 26 | [NSValue valueWithCGPoint:CGPointMake(UIScreen.mainScreen.bounds.size.width * 0.5 - 30, 100)], 27 | [NSValue valueWithCGPoint:CGPointMake(0, 100)]]; 28 | 29 | HZAnomalousButton *anomalousBtn0 = [[HZAnomalousButton alloc]initWithFrame:CGRectMake(0, 200, UIScreen.mainScreen.bounds.size.width * 0.5 + 30, 100) laySetOriginArr:laySetArr0]; 30 | [anomalousBtn0 setButtonClick:^{ 31 | NSLog(@"--------1--------"); 32 | }]; 33 | anomalousBtn0.backgroundColor = [UIColor yellowColor]; 34 | [self.view addSubview:anomalousBtn0]; 35 | 36 | 37 | NSArray *laySetArr1 = @[[NSValue valueWithCGPoint:CGPointMake(60, 0)], 38 | [NSValue valueWithCGPoint:CGPointMake(UIScreen.mainScreen.bounds.size.width * 0.5 + 30, 0)], 39 | [NSValue valueWithCGPoint:CGPointMake(UIScreen.mainScreen.bounds.size.width * 0.5 + 30, 100)], 40 | [NSValue valueWithCGPoint:CGPointMake(0, 100)]]; 41 | HZAnomalousButton *anomalousBtn1 = [[HZAnomalousButton alloc]initWithFrame:CGRectMake(UIScreen.mainScreen.bounds.size.width * 0.5 - 30, 200, UIScreen.mainScreen.bounds.size.width * 0.5 + 30, 100) laySetOriginArr:laySetArr1]; 42 | [anomalousBtn1 setButtonClick:^{ 43 | NSLog(@"-------2---------"); 44 | }]; 45 | anomalousBtn1.backgroundColor = [UIColor greenColor]; 46 | [self.view addSubview:anomalousBtn1]; 47 | } 48 | 49 | 50 | - (void)didReceiveMemoryWarning { 51 | [super didReceiveMemoryWarning]; 52 | // Dispose of any resources that can be recreated. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HZAnomalousButtonDemo 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemo/model.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JHB-Client/HZAnomalousButtonDemo/ba1f35bcae45e182d74100739233d5d6c719c213/HZAnomalousButtonDemo/model.PNG -------------------------------------------------------------------------------- /HZAnomalousButtonDemoTests/HZAnomalousButtonDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HZAnomalousButtonDemoTests.m 3 | // HZAnomalousButtonDemoTests 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HZAnomalousButtonDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HZAnomalousButtonDemoTests 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemoUITests/HZAnomalousButtonDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HZAnomalousButtonDemoUITests.m 3 | // HZAnomalousButtonDemoUITests 4 | // 5 | // Created by 季怀斌 on 2018/6/29. 6 | // Copyright © 2018年 huazhuo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HZAnomalousButtonDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HZAnomalousButtonDemoUITests 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 | -------------------------------------------------------------------------------- /HZAnomalousButtonDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HZAnomalousButtonDemo 2 | 不规则形状的按钮 3 | 4 | 效果图:👇 5 | 6 | 7 | ![](https://github.com/jihuaibin2017/HZAnomalousButtonDemo/blob/master/HZAnomalousButtonDemo/model.PNG) 8 | 9 | 觉得有帮助的话,请留下个小星星呗。谢谢! 10 | --------------------------------------------------------------------------------