├── 1.gif ├── AnimationButton.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── oujinlong.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── oujinlong.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── AnimationButton.xcscheme │ └── xcschememanagement.plist ├── AnimationButton ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── OJLAnimationButton │ ├── OJLAnimationButton.h │ ├── OJLAnimationButton.m │ ├── OJLCircleAnimationView.h │ └── OJLCircleAnimationView.m ├── OJLNav │ ├── OJLNavAnimation.h │ ├── OJLNavAnimation.m │ ├── OJLNavigationController.h │ └── OJLNavigationController.m ├── SecondViewController.h ├── SecondViewController.m ├── ViewController.h ├── ViewController.m └── main.m ├── AnimationButtonTests ├── AnimationButtonTests.m └── Info.plist ├── AnimationButtonUITests ├── AnimationButtonUITests.m └── Info.plist └── README.md /1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oujinlong/OJLAnimationButton/00d8e9045f487a2fd7c58ae7b3840aecbe96e405/1.gif -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 87F783721D11254A008E4E74 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783711D11254A008E4E74 /* main.m */; }; 11 | 87F783751D11254A008E4E74 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783741D11254A008E4E74 /* AppDelegate.m */; }; 12 | 87F783781D11254A008E4E74 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783771D11254A008E4E74 /* ViewController.m */; }; 13 | 87F7837B1D11254A008E4E74 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87F783791D11254A008E4E74 /* Main.storyboard */; }; 14 | 87F7837D1D11254A008E4E74 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87F7837C1D11254A008E4E74 /* Assets.xcassets */; }; 15 | 87F783801D11254A008E4E74 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87F7837E1D11254A008E4E74 /* LaunchScreen.storyboard */; }; 16 | 87F7838B1D11254A008E4E74 /* AnimationButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F7838A1D11254A008E4E74 /* AnimationButtonTests.m */; }; 17 | 87F783961D11254A008E4E74 /* AnimationButtonUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783951D11254A008E4E74 /* AnimationButtonUITests.m */; }; 18 | 87F783B41D113F38008E4E74 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783B31D113F38008E4E74 /* SecondViewController.m */; }; 19 | 87F783BA1D1144F1008E4E74 /* OJLAnimationButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783B71D1144F1008E4E74 /* OJLAnimationButton.m */; }; 20 | 87F783BB1D1144F1008E4E74 /* OJLCircleAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783B91D1144F1008E4E74 /* OJLCircleAnimationView.m */; }; 21 | 87F783C11D114514008E4E74 /* OJLNavAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783BE1D114514008E4E74 /* OJLNavAnimation.m */; }; 22 | 87F783C21D114514008E4E74 /* OJLNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87F783C01D114514008E4E74 /* OJLNavigationController.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 87F783871D11254A008E4E74 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 87F783651D112549008E4E74 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 87F7836C1D112549008E4E74; 31 | remoteInfo = AnimationButton; 32 | }; 33 | 87F783921D11254A008E4E74 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 87F783651D112549008E4E74 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 87F7836C1D112549008E4E74; 38 | remoteInfo = AnimationButton; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 87F7836D1D112549008E4E74 /* AnimationButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AnimationButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 87F783711D11254A008E4E74 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 87F783731D11254A008E4E74 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 87F783741D11254A008E4E74 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 87F783761D11254A008E4E74 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 87F783771D11254A008E4E74 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 87F7837A1D11254A008E4E74 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 87F7837C1D11254A008E4E74 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 87F7837F1D11254A008E4E74 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 87F783811D11254A008E4E74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 87F783861D11254A008E4E74 /* AnimationButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AnimationButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 87F7838A1D11254A008E4E74 /* AnimationButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnimationButtonTests.m; sourceTree = ""; }; 55 | 87F7838C1D11254A008E4E74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 87F783911D11254A008E4E74 /* AnimationButtonUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AnimationButtonUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 87F783951D11254A008E4E74 /* AnimationButtonUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnimationButtonUITests.m; sourceTree = ""; }; 58 | 87F783971D11254A008E4E74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 87F783B21D113F38008E4E74 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 60 | 87F783B31D113F38008E4E74 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 61 | 87F783B61D1144F1008E4E74 /* OJLAnimationButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OJLAnimationButton.h; sourceTree = ""; }; 62 | 87F783B71D1144F1008E4E74 /* OJLAnimationButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OJLAnimationButton.m; sourceTree = ""; }; 63 | 87F783B81D1144F1008E4E74 /* OJLCircleAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OJLCircleAnimationView.h; sourceTree = ""; }; 64 | 87F783B91D1144F1008E4E74 /* OJLCircleAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OJLCircleAnimationView.m; sourceTree = ""; }; 65 | 87F783BD1D114514008E4E74 /* OJLNavAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OJLNavAnimation.h; sourceTree = ""; }; 66 | 87F783BE1D114514008E4E74 /* OJLNavAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OJLNavAnimation.m; sourceTree = ""; }; 67 | 87F783BF1D114514008E4E74 /* OJLNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OJLNavigationController.h; sourceTree = ""; }; 68 | 87F783C01D114514008E4E74 /* OJLNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OJLNavigationController.m; sourceTree = ""; }; 69 | /* End PBXFileReference section */ 70 | 71 | /* Begin PBXFrameworksBuildPhase section */ 72 | 87F7836A1D112549008E4E74 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 87F783831D11254A008E4E74 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 87F7838E1D11254A008E4E74 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 87F783641D112549008E4E74 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 87F7836F1D112549008E4E74 /* AnimationButton */, 100 | 87F783891D11254A008E4E74 /* AnimationButtonTests */, 101 | 87F783941D11254A008E4E74 /* AnimationButtonUITests */, 102 | 87F7836E1D112549008E4E74 /* Products */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 87F7836E1D112549008E4E74 /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 87F7836D1D112549008E4E74 /* AnimationButton.app */, 110 | 87F783861D11254A008E4E74 /* AnimationButtonTests.xctest */, 111 | 87F783911D11254A008E4E74 /* AnimationButtonUITests.xctest */, 112 | ); 113 | name = Products; 114 | sourceTree = ""; 115 | }; 116 | 87F7836F1D112549008E4E74 /* AnimationButton */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 87F783731D11254A008E4E74 /* AppDelegate.h */, 120 | 87F783741D11254A008E4E74 /* AppDelegate.m */, 121 | 87F783761D11254A008E4E74 /* ViewController.h */, 122 | 87F783771D11254A008E4E74 /* ViewController.m */, 123 | 87F783B21D113F38008E4E74 /* SecondViewController.h */, 124 | 87F783B31D113F38008E4E74 /* SecondViewController.m */, 125 | 87F783BC1D114514008E4E74 /* OJLNav */, 126 | 87F783B51D1144F1008E4E74 /* OJLAnimationButton */, 127 | 87F783791D11254A008E4E74 /* Main.storyboard */, 128 | 87F7837C1D11254A008E4E74 /* Assets.xcassets */, 129 | 87F7837E1D11254A008E4E74 /* LaunchScreen.storyboard */, 130 | 87F783811D11254A008E4E74 /* Info.plist */, 131 | 87F783701D112549008E4E74 /* Supporting Files */, 132 | ); 133 | path = AnimationButton; 134 | sourceTree = ""; 135 | }; 136 | 87F783701D112549008E4E74 /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 87F783711D11254A008E4E74 /* main.m */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 87F783891D11254A008E4E74 /* AnimationButtonTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 87F7838A1D11254A008E4E74 /* AnimationButtonTests.m */, 148 | 87F7838C1D11254A008E4E74 /* Info.plist */, 149 | ); 150 | path = AnimationButtonTests; 151 | sourceTree = ""; 152 | }; 153 | 87F783941D11254A008E4E74 /* AnimationButtonUITests */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 87F783951D11254A008E4E74 /* AnimationButtonUITests.m */, 157 | 87F783971D11254A008E4E74 /* Info.plist */, 158 | ); 159 | path = AnimationButtonUITests; 160 | sourceTree = ""; 161 | }; 162 | 87F783B51D1144F1008E4E74 /* OJLAnimationButton */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 87F783B61D1144F1008E4E74 /* OJLAnimationButton.h */, 166 | 87F783B71D1144F1008E4E74 /* OJLAnimationButton.m */, 167 | 87F783B81D1144F1008E4E74 /* OJLCircleAnimationView.h */, 168 | 87F783B91D1144F1008E4E74 /* OJLCircleAnimationView.m */, 169 | ); 170 | path = OJLAnimationButton; 171 | sourceTree = ""; 172 | }; 173 | 87F783BC1D114514008E4E74 /* OJLNav */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 87F783BD1D114514008E4E74 /* OJLNavAnimation.h */, 177 | 87F783BE1D114514008E4E74 /* OJLNavAnimation.m */, 178 | 87F783BF1D114514008E4E74 /* OJLNavigationController.h */, 179 | 87F783C01D114514008E4E74 /* OJLNavigationController.m */, 180 | ); 181 | path = OJLNav; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXGroup section */ 185 | 186 | /* Begin PBXNativeTarget section */ 187 | 87F7836C1D112549008E4E74 /* AnimationButton */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 87F7839A1D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButton" */; 190 | buildPhases = ( 191 | 87F783691D112549008E4E74 /* Sources */, 192 | 87F7836A1D112549008E4E74 /* Frameworks */, 193 | 87F7836B1D112549008E4E74 /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | ); 199 | name = AnimationButton; 200 | productName = AnimationButton; 201 | productReference = 87F7836D1D112549008E4E74 /* AnimationButton.app */; 202 | productType = "com.apple.product-type.application"; 203 | }; 204 | 87F783851D11254A008E4E74 /* AnimationButtonTests */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 87F7839D1D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButtonTests" */; 207 | buildPhases = ( 208 | 87F783821D11254A008E4E74 /* Sources */, 209 | 87F783831D11254A008E4E74 /* Frameworks */, 210 | 87F783841D11254A008E4E74 /* Resources */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | 87F783881D11254A008E4E74 /* PBXTargetDependency */, 216 | ); 217 | name = AnimationButtonTests; 218 | productName = AnimationButtonTests; 219 | productReference = 87F783861D11254A008E4E74 /* AnimationButtonTests.xctest */; 220 | productType = "com.apple.product-type.bundle.unit-test"; 221 | }; 222 | 87F783901D11254A008E4E74 /* AnimationButtonUITests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 87F783A01D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButtonUITests" */; 225 | buildPhases = ( 226 | 87F7838D1D11254A008E4E74 /* Sources */, 227 | 87F7838E1D11254A008E4E74 /* Frameworks */, 228 | 87F7838F1D11254A008E4E74 /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 87F783931D11254A008E4E74 /* PBXTargetDependency */, 234 | ); 235 | name = AnimationButtonUITests; 236 | productName = AnimationButtonUITests; 237 | productReference = 87F783911D11254A008E4E74 /* AnimationButtonUITests.xctest */; 238 | productType = "com.apple.product-type.bundle.ui-testing"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 87F783651D112549008E4E74 /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastUpgradeCheck = 0720; 247 | ORGANIZATIONNAME = oujinlong; 248 | TargetAttributes = { 249 | 87F7836C1D112549008E4E74 = { 250 | CreatedOnToolsVersion = 7.2.1; 251 | }; 252 | 87F783851D11254A008E4E74 = { 253 | CreatedOnToolsVersion = 7.2.1; 254 | TestTargetID = 87F7836C1D112549008E4E74; 255 | }; 256 | 87F783901D11254A008E4E74 = { 257 | CreatedOnToolsVersion = 7.2.1; 258 | TestTargetID = 87F7836C1D112549008E4E74; 259 | }; 260 | }; 261 | }; 262 | buildConfigurationList = 87F783681D112549008E4E74 /* Build configuration list for PBXProject "AnimationButton" */; 263 | compatibilityVersion = "Xcode 3.2"; 264 | developmentRegion = English; 265 | hasScannedForEncodings = 0; 266 | knownRegions = ( 267 | en, 268 | Base, 269 | ); 270 | mainGroup = 87F783641D112549008E4E74; 271 | productRefGroup = 87F7836E1D112549008E4E74 /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | 87F7836C1D112549008E4E74 /* AnimationButton */, 276 | 87F783851D11254A008E4E74 /* AnimationButtonTests */, 277 | 87F783901D11254A008E4E74 /* AnimationButtonUITests */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXResourcesBuildPhase section */ 283 | 87F7836B1D112549008E4E74 /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | 87F783801D11254A008E4E74 /* LaunchScreen.storyboard in Resources */, 288 | 87F7837D1D11254A008E4E74 /* Assets.xcassets in Resources */, 289 | 87F7837B1D11254A008E4E74 /* Main.storyboard in Resources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 87F783841D11254A008E4E74 /* Resources */ = { 294 | isa = PBXResourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | 87F7838F1D11254A008E4E74 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | /* End PBXResourcesBuildPhase section */ 308 | 309 | /* Begin PBXSourcesBuildPhase section */ 310 | 87F783691D112549008E4E74 /* Sources */ = { 311 | isa = PBXSourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | 87F783781D11254A008E4E74 /* ViewController.m in Sources */, 315 | 87F783BB1D1144F1008E4E74 /* OJLCircleAnimationView.m in Sources */, 316 | 87F783C21D114514008E4E74 /* OJLNavigationController.m in Sources */, 317 | 87F783751D11254A008E4E74 /* AppDelegate.m in Sources */, 318 | 87F783B41D113F38008E4E74 /* SecondViewController.m in Sources */, 319 | 87F783C11D114514008E4E74 /* OJLNavAnimation.m in Sources */, 320 | 87F783BA1D1144F1008E4E74 /* OJLAnimationButton.m in Sources */, 321 | 87F783721D11254A008E4E74 /* main.m in Sources */, 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | 87F783821D11254A008E4E74 /* Sources */ = { 326 | isa = PBXSourcesBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | 87F7838B1D11254A008E4E74 /* AnimationButtonTests.m in Sources */, 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | }; 333 | 87F7838D1D11254A008E4E74 /* Sources */ = { 334 | isa = PBXSourcesBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | 87F783961D11254A008E4E74 /* AnimationButtonUITests.m in Sources */, 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | }; 341 | /* End PBXSourcesBuildPhase section */ 342 | 343 | /* Begin PBXTargetDependency section */ 344 | 87F783881D11254A008E4E74 /* PBXTargetDependency */ = { 345 | isa = PBXTargetDependency; 346 | target = 87F7836C1D112549008E4E74 /* AnimationButton */; 347 | targetProxy = 87F783871D11254A008E4E74 /* PBXContainerItemProxy */; 348 | }; 349 | 87F783931D11254A008E4E74 /* PBXTargetDependency */ = { 350 | isa = PBXTargetDependency; 351 | target = 87F7836C1D112549008E4E74 /* AnimationButton */; 352 | targetProxy = 87F783921D11254A008E4E74 /* PBXContainerItemProxy */; 353 | }; 354 | /* End PBXTargetDependency section */ 355 | 356 | /* Begin PBXVariantGroup section */ 357 | 87F783791D11254A008E4E74 /* Main.storyboard */ = { 358 | isa = PBXVariantGroup; 359 | children = ( 360 | 87F7837A1D11254A008E4E74 /* Base */, 361 | ); 362 | name = Main.storyboard; 363 | sourceTree = ""; 364 | }; 365 | 87F7837E1D11254A008E4E74 /* LaunchScreen.storyboard */ = { 366 | isa = PBXVariantGroup; 367 | children = ( 368 | 87F7837F1D11254A008E4E74 /* Base */, 369 | ); 370 | name = LaunchScreen.storyboard; 371 | sourceTree = ""; 372 | }; 373 | /* End PBXVariantGroup section */ 374 | 375 | /* Begin XCBuildConfiguration section */ 376 | 87F783981D11254A008E4E74 /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = dwarf; 396 | ENABLE_STRICT_OBJC_MSGSEND = YES; 397 | ENABLE_TESTABILITY = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_DYNAMIC_NO_PIC = NO; 400 | GCC_NO_COMMON_BLOCKS = YES; 401 | GCC_OPTIMIZATION_LEVEL = 0; 402 | GCC_PREPROCESSOR_DEFINITIONS = ( 403 | "DEBUG=1", 404 | "$(inherited)", 405 | ); 406 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 407 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 408 | GCC_WARN_UNDECLARED_SELECTOR = YES; 409 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 410 | GCC_WARN_UNUSED_FUNCTION = YES; 411 | GCC_WARN_UNUSED_VARIABLE = YES; 412 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 413 | MTL_ENABLE_DEBUG_INFO = YES; 414 | ONLY_ACTIVE_ARCH = YES; 415 | SDKROOT = iphoneos; 416 | }; 417 | name = Debug; 418 | }; 419 | 87F783991D11254A008E4E74 /* Release */ = { 420 | isa = XCBuildConfiguration; 421 | buildSettings = { 422 | ALWAYS_SEARCH_USER_PATHS = NO; 423 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 424 | CLANG_CXX_LIBRARY = "libc++"; 425 | CLANG_ENABLE_MODULES = YES; 426 | CLANG_ENABLE_OBJC_ARC = YES; 427 | CLANG_WARN_BOOL_CONVERSION = YES; 428 | CLANG_WARN_CONSTANT_CONVERSION = YES; 429 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 430 | CLANG_WARN_EMPTY_BODY = YES; 431 | CLANG_WARN_ENUM_CONVERSION = YES; 432 | CLANG_WARN_INT_CONVERSION = YES; 433 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 434 | CLANG_WARN_UNREACHABLE_CODE = YES; 435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 436 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 437 | COPY_PHASE_STRIP = NO; 438 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 439 | ENABLE_NS_ASSERTIONS = NO; 440 | ENABLE_STRICT_OBJC_MSGSEND = YES; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_NO_COMMON_BLOCKS = YES; 443 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 444 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 445 | GCC_WARN_UNDECLARED_SELECTOR = YES; 446 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 447 | GCC_WARN_UNUSED_FUNCTION = YES; 448 | GCC_WARN_UNUSED_VARIABLE = YES; 449 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 450 | MTL_ENABLE_DEBUG_INFO = NO; 451 | SDKROOT = iphoneos; 452 | VALIDATE_PRODUCT = YES; 453 | }; 454 | name = Release; 455 | }; 456 | 87F7839B1D11254A008E4E74 /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | INFOPLIST_FILE = AnimationButton/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButton; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | }; 465 | name = Debug; 466 | }; 467 | 87F7839C1D11254A008E4E74 /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | INFOPLIST_FILE = AnimationButton/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButton; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | }; 476 | name = Release; 477 | }; 478 | 87F7839E1D11254A008E4E74 /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | BUNDLE_LOADER = "$(TEST_HOST)"; 482 | INFOPLIST_FILE = AnimationButtonTests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButtonTests; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AnimationButton.app/AnimationButton"; 487 | }; 488 | name = Debug; 489 | }; 490 | 87F7839F1D11254A008E4E74 /* Release */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | BUNDLE_LOADER = "$(TEST_HOST)"; 494 | INFOPLIST_FILE = AnimationButtonTests/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 496 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButtonTests; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AnimationButton.app/AnimationButton"; 499 | }; 500 | name = Release; 501 | }; 502 | 87F783A11D11254A008E4E74 /* Debug */ = { 503 | isa = XCBuildConfiguration; 504 | buildSettings = { 505 | INFOPLIST_FILE = AnimationButtonUITests/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButtonUITests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TEST_TARGET_NAME = AnimationButton; 510 | USES_XCTRUNNER = YES; 511 | }; 512 | name = Debug; 513 | }; 514 | 87F783A21D11254A008E4E74 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | INFOPLIST_FILE = AnimationButtonUITests/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 519 | PRODUCT_BUNDLE_IDENTIFIER = AsiaInfo.AnimationButtonUITests; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | TEST_TARGET_NAME = AnimationButton; 522 | USES_XCTRUNNER = YES; 523 | }; 524 | name = Release; 525 | }; 526 | /* End XCBuildConfiguration section */ 527 | 528 | /* Begin XCConfigurationList section */ 529 | 87F783681D112549008E4E74 /* Build configuration list for PBXProject "AnimationButton" */ = { 530 | isa = XCConfigurationList; 531 | buildConfigurations = ( 532 | 87F783981D11254A008E4E74 /* Debug */, 533 | 87F783991D11254A008E4E74 /* Release */, 534 | ); 535 | defaultConfigurationIsVisible = 0; 536 | defaultConfigurationName = Release; 537 | }; 538 | 87F7839A1D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButton" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 87F7839B1D11254A008E4E74 /* Debug */, 542 | 87F7839C1D11254A008E4E74 /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | }; 546 | 87F7839D1D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButtonTests" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | 87F7839E1D11254A008E4E74 /* Debug */, 550 | 87F7839F1D11254A008E4E74 /* Release */, 551 | ); 552 | defaultConfigurationIsVisible = 0; 553 | }; 554 | 87F783A01D11254A008E4E74 /* Build configuration list for PBXNativeTarget "AnimationButtonUITests" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 87F783A11D11254A008E4E74 /* Debug */, 558 | 87F783A21D11254A008E4E74 /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | }; 562 | /* End XCConfigurationList section */ 563 | }; 564 | rootObject = 87F783651D112549008E4E74 /* Project object */; 565 | } 566 | -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/project.xcworkspace/xcuserdata/oujinlong.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oujinlong/OJLAnimationButton/00d8e9045f487a2fd7c58ae7b3840aecbe96e405/AnimationButton.xcodeproj/project.xcworkspace/xcuserdata/oujinlong.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/xcuserdata/oujinlong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/xcuserdata/oujinlong.xcuserdatad/xcschemes/AnimationButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /AnimationButton.xcodeproj/xcuserdata/oujinlong.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AnimationButton.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 87F7836C1D112549008E4E74 16 | 17 | primary 18 | 19 | 20 | 87F783851D11254A008E4E74 21 | 22 | primary 23 | 24 | 25 | 87F783901D11254A008E4E74 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /AnimationButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. 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 | -------------------------------------------------------------------------------- /AnimationButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /AnimationButton/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /AnimationButton/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 | -------------------------------------------------------------------------------- /AnimationButton/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 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /AnimationButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /AnimationButton/OJLAnimationButton/OJLAnimationButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // OJLAnimationButton.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class OJLAnimationButton; 12 | @protocol OJLAnimationButtonDelegate 13 | /** 14 | * 动画开始回调 15 | * 16 | * @param OJLAnimationButton self 17 | */ 18 | -(void)OJLAnimationButtonDidStartAnimation:(OJLAnimationButton*)OJLAnimationButton; 19 | 20 | /** 21 | * 动画已经结束时回调 22 | * 23 | * @param OJLAnimationButton self 24 | */ 25 | -(void)OJLAnimationButtonDidFinishAnimation:(OJLAnimationButton *)OJLAnimationButton; 26 | 27 | /** 28 | * 动画将要结束时回调 即 结束动画未执行时 29 | * 30 | * @param OJLAnimationButton self 31 | */ 32 | -(void)OJLAnimationButtonWillFinishAnimation:(OJLAnimationButton *)OJLAnimationButton; 33 | 34 | @end 35 | @interface OJLAnimationButton : UIButton 36 | /** 37 | * 创建对象 38 | * 39 | * @param frame 40 | * 41 | * @return 对象 42 | */ 43 | +(instancetype)buttonWithFrame:(CGRect)frame; 44 | /** 45 | * 边缘色 46 | * 47 | * @param color 48 | */ 49 | -(void)setborderColor:(UIColor*)color; 50 | /** 51 | * 边缘宽度 52 | * 53 | * @param width 54 | */ 55 | -(void)setborderWidth:(CGFloat)width; 56 | /** 57 | * 手动调用执行动画 一般在 button 的响应里调用 调用后会走代理进行回调 58 | */ 59 | -(void)startAnimation; 60 | /** 61 | * 手动停止动画 停止前和停止后会走代理回调 62 | */ 63 | -(void)stopAnimation; 64 | /** 65 | * 代理对象 66 | */ 67 | @property (nonatomic, weak) id delegate; 68 | @end 69 | -------------------------------------------------------------------------------- /AnimationButton/OJLAnimationButton/OJLAnimationButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // OJLAnimationButton.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "OJLAnimationButton.h" 10 | #import "OJLCircleAnimationView.h" 11 | static NSTimeInterval startDuration = 0.3; 12 | static NSTimeInterval endDuration = 0.5; 13 | @interface OJLAnimationButton () 14 | @property (nonatomic, strong) OJLCircleAnimationView* circleView; 15 | @property (nonatomic, assign) CGRect origionRect; 16 | @end 17 | @implementation OJLAnimationButton 18 | - (OJLCircleAnimationView *)circleView 19 | { 20 | if (!_circleView) { 21 | _circleView = [OJLCircleAnimationView viewWithButton:self]; 22 | [self addSubview:_circleView]; 23 | } 24 | return _circleView; 25 | } 26 | 27 | +(instancetype)buttonWithFrame:(CGRect)frame{ 28 | OJLAnimationButton* button = [OJLAnimationButton buttonWithType:UIButtonTypeCustom]; 29 | 30 | button.frame = frame; 31 | button.layer.cornerRadius = frame.size.height / 2; 32 | button.layer.masksToBounds = YES; 33 | button.clipsToBounds = NO; 34 | button.origionRect = button.frame; 35 | return button; 36 | } 37 | 38 | 39 | -(void)setborderColor:(UIColor *)color{ 40 | self.layer.borderColor = color.CGColor; 41 | 42 | } 43 | 44 | -(void)setborderWidth:(CGFloat)width{ 45 | self.layer.borderWidth = width; 46 | } 47 | 48 | 49 | 50 | -(void)startAnimation{ 51 | CGPoint center = self.center; 52 | CGFloat width = self.layer.cornerRadius * 2; 53 | CGFloat height = self.frame.size.height; 54 | CGRect desFrame = CGRectMake(center.x - width / 2, center.y - height / 2, width, height); 55 | 56 | self.userInteractionEnabled = NO; 57 | 58 | if ([self.delegate respondsToSelector:@selector(OJLAnimationButtonDidStartAnimation:)]) { 59 | [self.delegate OJLAnimationButtonDidStartAnimation:self]; 60 | } 61 | 62 | [UIView animateWithDuration:startDuration animations:^{ 63 | self.titleLabel.alpha = .0f; 64 | self.frame = desFrame; 65 | } completion:^(BOOL finished) { 66 | 67 | [self.circleView startAnimation]; 68 | }]; 69 | } 70 | 71 | -(void)stopAnimation{ 72 | self.userInteractionEnabled = YES; 73 | 74 | 75 | if ([self.delegate respondsToSelector:@selector(OJLAnimationButtonWillFinishAnimation:)]) { 76 | [self.delegate OJLAnimationButtonWillFinishAnimation:self]; 77 | } 78 | 79 | [self.circleView removeFromSuperview]; 80 | self.circleView = nil; 81 | [UIView animateWithDuration:endDuration animations:^{ 82 | self.frame = self.origionRect; 83 | self.titleLabel.alpha = 1.0f; 84 | } completion:^(BOOL finished) { 85 | if ([self.delegate respondsToSelector:@selector(OJLAnimationButtonDidFinishAnimation:)]) { 86 | [self.delegate OJLAnimationButtonDidFinishAnimation:self]; 87 | } 88 | }]; 89 | 90 | } 91 | @end 92 | -------------------------------------------------------------------------------- /AnimationButton/OJLAnimationButton/OJLCircleAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // OJLCircleAnimationView.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OJLCircleAnimationView : UIView 12 | +(instancetype)viewWithButton:(UIButton*)button; 13 | -(void)startAnimation; 14 | @end 15 | -------------------------------------------------------------------------------- /AnimationButton/OJLAnimationButton/OJLCircleAnimationView.m: -------------------------------------------------------------------------------- 1 | // 2 | // OJLCircleAnimationView.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "OJLCircleAnimationView.h" 10 | 11 | @interface OJLCircleAnimationView () 12 | @property (nonatomic, strong) UIColor* borderColor; 13 | @property (nonatomic, assign) CGFloat timeFlag; 14 | @property (nonatomic, strong) NSTimer* timer; 15 | @end 16 | @implementation OJLCircleAnimationView 17 | 18 | +(instancetype)viewWithButton:(UIButton *)button{ 19 | OJLCircleAnimationView* animationView = [[OJLCircleAnimationView alloc] init]; 20 | 21 | animationView.frame = CGRectMake(-8, -8, button.frame.size.width + 16, button.frame.size.height + 16); 22 | 23 | animationView.backgroundColor = [UIColor clearColor]; 24 | 25 | animationView.borderColor = button.titleLabel.textColor; 26 | 27 | animationView.timeFlag = 0; 28 | return animationView; 29 | } 30 | -(void)removeFromSuperview{ 31 | [self.timer invalidate]; 32 | [super removeFromSuperview]; 33 | } 34 | -(void)startAnimation{ 35 | self.timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(continueAnimation) userInfo:nil repeats:YES]; 36 | [self.timer fire]; 37 | 38 | } 39 | -(void)continueAnimation{ 40 | self.timeFlag += 0.02; 41 | 42 | [self setNeedsDisplay]; 43 | 44 | } 45 | -(void)drawRect:(CGRect)rect{ 46 | 47 | 48 | UIBezierPath* path = [UIBezierPath bezierPath]; 49 | 50 | 51 | CGPoint center = CGPointMake(rect.size.width / 2, rect.size.height / 2); 52 | CGFloat radius = rect.size.width / 2 - 2; 53 | CGFloat start = - M_PI_2 + self.timeFlag * 2*M_PI; 54 | CGFloat end = -M_PI_2 + 0.45 * 2 * M_PI + self.timeFlag * 2 *M_PI; 55 | 56 | [path addArcWithCenter:center radius:radius startAngle:start endAngle:end clockwise:YES]; 57 | 58 | [self.borderColor setStroke]; 59 | path.lineWidth = 1.5; 60 | 61 | [path stroke]; 62 | } 63 | @end 64 | -------------------------------------------------------------------------------- /AnimationButton/OJLNav/OJLNavAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // OJLNavAnimation.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OJLNavAnimation : NSObject 12 | @property (nonatomic, strong) UIButton* centerButton; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /AnimationButton/OJLNav/OJLNavAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // OJLNavAnimation.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "OJLNavAnimation.h" 10 | 11 | @interface OJLNavAnimation () 12 | @property (nonatomic, strong)id transitionContext; 13 | @end 14 | @implementation OJLNavAnimation 15 | -(NSTimeInterval)transitionDuration:(id)transitionContext{ 16 | return 0.5; 17 | } 18 | 19 | -(void)animateTransition:(id)transitionContext{ 20 | self.transitionContext = transitionContext; 21 | 22 | UIView* contentView = [self.transitionContext containerView]; 23 | 24 | 25 | CGPoint point = self.centerButton.center; 26 | UIBezierPath* origionPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(point.x , point.y, 0, 0)]; 27 | 28 | CGFloat X = [UIScreen mainScreen].bounds.size.width - point.x; 29 | CGFloat Y = [UIScreen mainScreen].bounds.size.height - point.y; 30 | CGFloat radius = sqrtf(X * X + Y * Y); 31 | UIBezierPath* finalPath = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(CGRectMake(point.x , point.y, 0, 0), -radius, -radius)]; 32 | 33 | UIViewController* toVc = [self.transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 34 | CAShapeLayer* layer = [CAShapeLayer layer]; 35 | layer.path = finalPath.CGPath; 36 | toVc.view.layer.mask = layer; 37 | 38 | CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"path"]; 39 | animation.delegate = self; 40 | animation.fromValue = (__bridge id _Nullable)(origionPath.CGPath); 41 | animation.toValue = (__bridge id _Nullable)(finalPath.CGPath); 42 | animation.duration = 0.25; 43 | [layer addAnimation:animation forKey:@"path"]; 44 | 45 | [contentView addSubview:toVc.view]; 46 | } 47 | 48 | -(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{ 49 | [self.transitionContext completeTransition:YES]; 50 | } 51 | @end 52 | -------------------------------------------------------------------------------- /AnimationButton/OJLNav/OJLNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OJLNavigationController.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OJLNavigationController : UINavigationController 12 | -(void)pushViewController:(UIViewController *)viewController withCenterButton:(UIButton*)button; 13 | @end 14 | -------------------------------------------------------------------------------- /AnimationButton/OJLNav/OJLNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // OJLNavigationController.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "OJLNavigationController.h" 10 | #import "OJLNavAnimation.h" 11 | @interface OJLNavigationController () 12 | @property (nonatomic, strong) UIButton* centerButton; 13 | @end 14 | 15 | @implementation OJLNavigationController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | 25 | } 26 | -(void)pushViewController:(UIViewController *)viewController withCenterButton:(UIButton *)button{ 27 | self.centerButton = button; 28 | self.delegate = self; 29 | 30 | [super pushViewController:viewController animated:YES]; 31 | } 32 | #pragma mark UINavigationControllerDelegate 33 | -(id)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC{ 34 | OJLNavAnimation* animation = [OJLNavAnimation new]; 35 | animation.centerButton = self.centerButton; 36 | return animation; 37 | } 38 | /* 39 | #pragma mark - Navigation 40 | 41 | // In a storyboard-based application, you will often want to do a little preparation before navigation 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 43 | // Get the new view controller using [segue destinationViewController]. 44 | // Pass the selected object to the new view controller. 45 | } 46 | */ 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /AnimationButton/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AnimationButton/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | 11 | @interface SecondViewController () 12 | 13 | @end 14 | 15 | @implementation SecondViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | //255 94 87 21 | self.view.backgroundColor = [UIColor colorWithRed:255/255.0 green:94/255.0 blue:87/255.0 alpha:1]; 22 | } 23 | 24 | - (void)didReceiveMemoryWarning { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | /* 30 | #pragma mark - Navigation 31 | 32 | // In a storyboard-based application, you will often want to do a little preparation before navigation 33 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 34 | // Get the new view controller using [segue destinationViewController]. 35 | // Pass the selected object to the new view controller. 36 | } 37 | */ 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /AnimationButton/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AnimationButton/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "OJLAnimationButton.h" 11 | #import "SecondViewController.h" 12 | #import "OJLNavigationController.h" 13 | @interface ViewController () 14 | @property (nonatomic, weak) OJLAnimationButton* button1; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.navigationController.navigationBarHidden = YES; 23 | 24 | self.view.backgroundColor = [UIColor colorWithRed:18/255.0 green:200/255.0 blue:252/255.0 alpha:1]; 25 | 26 | OJLAnimationButton* button1 = [OJLAnimationButton buttonWithFrame:CGRectMake(30, 300, self.view.bounds.size.width - 2 * 30, 50)]; 27 | self.button1 = button1; 28 | button1.delegate = self; 29 | [button1 setTitle:@"Login" forState:UIControlStateNormal]; 30 | [button1 setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal]; 31 | [button1 setBackgroundColor:[UIColor whiteColor]]; 32 | [self.view addSubview:button1]; 33 | 34 | [button1 addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; 35 | 36 | 37 | OJLAnimationButton* button2 = [OJLAnimationButton buttonWithFrame:CGRectMake(80, 100, self.view.bounds.size.width - 2 * 80, 50)]; 38 | button2.delegate = self; 39 | [button2 setTitle:@"OK" forState:UIControlStateNormal]; 40 | [button2 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal]; 41 | [button2 setBackgroundColor:[UIColor whiteColor]]; 42 | [self.view addSubview:button2]; 43 | 44 | [button2 addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; 45 | } 46 | -(void)click:(OJLAnimationButton*)button{ 47 | 48 | [button startAnimation]; 49 | 50 | } 51 | 52 | #pragma mark OJLAnimationButtonDelegate 53 | -(void)OJLAnimationButtonDidStartAnimation:(OJLAnimationButton *)OJLAnimationButton{ 54 | NSLog(@"start"); 55 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.8 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 56 | [OJLAnimationButton stopAnimation]; 57 | }); 58 | } 59 | 60 | -(void)OJLAnimationButtonDidFinishAnimation:(OJLAnimationButton *)OJLAnimationButton{ 61 | NSLog(@"stop"); 62 | } 63 | 64 | -(void)OJLAnimationButtonWillFinishAnimation:(OJLAnimationButton *)OJLAnimationButton{ 65 | if (OJLAnimationButton == self.button1) { 66 | 67 | SecondViewController* vc = [[SecondViewController alloc] init]; 68 | [((OJLNavigationController*)self.navigationController) pushViewController:vc withCenterButton:OJLAnimationButton]; 69 | } 70 | } 71 | @end 72 | -------------------------------------------------------------------------------- /AnimationButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AnimationButton 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. 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 | -------------------------------------------------------------------------------- /AnimationButtonTests/AnimationButtonTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AnimationButtonTests.m 3 | // AnimationButtonTests 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AnimationButtonTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AnimationButtonTests 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 | -------------------------------------------------------------------------------- /AnimationButtonTests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /AnimationButtonUITests/AnimationButtonUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AnimationButtonUITests.m 3 | // AnimationButtonUITests 4 | // 5 | // Created by oujinlong on 16/6/15. 6 | // Copyright © 2016年 oujinlong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AnimationButtonUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AnimationButtonUITests 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 | -------------------------------------------------------------------------------- /AnimationButtonUITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OJLAnimationButton 2 | ![image](https://github.com/oujinlong/OJLAnimationButton/blob/master/1.gif) 3 | --------------------------------------------------------------------------------