├── DGThumbUpButton Objc ├── DGThumbUpButton.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ ├── Desgard_Duan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── developer.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── Desgard_Duan.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── DGThumbUpButton.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── developer.xcuserdatad │ │ └── xcschemes │ │ ├── DGThumbUpButton.xcscheme │ │ └── xcschememanagement.plist └── DGThumbUpButton │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── Like-Blue.imageset │ │ ├── Contents.json │ │ └── Like-Blue.png │ ├── Like-PlaceHold.imageset │ │ ├── Contents.json │ │ └── Like-PlaceHold.png │ └── Like-Sparkle.imageset │ │ ├── Contents.json │ │ └── Like-Sparkle.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── DGThumbUpButton │ ├── DGExplodeAnimationView.h │ ├── DGExplodeAnimationView.m │ ├── DGThumbUpButton.h │ └── DGThumbUpButton.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── DGThumbUpButton.podspec ├── DGThumbUpButton ├── DGExplodeAnimationView.h ├── DGExplodeAnimationView.m ├── DGThumbUpButton.h ├── DGThumbUpButton.m ├── Like-Blue.png ├── Like-PlaceHold.png └── Like-Sparkle.png ├── LICENSE ├── README.md └── Source └── demo0.gif /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D54C93F51D094C620015B780 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D54C93F41D094C620015B780 /* main.m */; }; 11 | D54C93F81D094C620015B780 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D54C93F71D094C620015B780 /* AppDelegate.m */; }; 12 | D54C93FB1D094C620015B780 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D54C93FA1D094C620015B780 /* ViewController.m */; }; 13 | D54C93FE1D094C620015B780 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D54C93FC1D094C620015B780 /* Main.storyboard */; }; 14 | D54C94001D094C620015B780 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D54C93FF1D094C620015B780 /* Assets.xcassets */; }; 15 | D54C94031D094C620015B780 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D54C94011D094C620015B780 /* LaunchScreen.storyboard */; }; 16 | D58C7D211D0A33F60032673C /* DGExplodeAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = D58C7D1E1D0A33F60032673C /* DGExplodeAnimationView.m */; }; 17 | D58C7D221D0A33F60032673C /* DGThumbUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D58C7D201D0A33F60032673C /* DGThumbUpButton.m */; }; 18 | D58C7D251D0A38FD0032673C /* Like-Blue.png in Resources */ = {isa = PBXBuildFile; fileRef = D58C7D241D0A38FD0032673C /* Like-Blue.png */; }; 19 | D58C7D271D0A39030032673C /* Like-PlaceHold.png in Resources */ = {isa = PBXBuildFile; fileRef = D58C7D261D0A39030032673C /* Like-PlaceHold.png */; }; 20 | D58C7D291D0A39090032673C /* Like-Sparkle.png in Resources */ = {isa = PBXBuildFile; fileRef = D58C7D281D0A39090032673C /* Like-Sparkle.png */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | D58C7D181D0A2C750032673C /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = D54C93E81D094C620015B780 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = D54C93EF1D094C620015B780; 29 | remoteInfo = DGThumbUpButton; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | D54C93F01D094C620015B780 /* DGThumbUpButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DGThumbUpButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | D54C93F41D094C620015B780 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | D54C93F61D094C620015B780 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | D54C93F71D094C620015B780 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | D54C93F91D094C620015B780 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | D54C93FA1D094C620015B780 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | D54C93FD1D094C620015B780 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | D54C93FF1D094C620015B780 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | D54C94021D094C620015B780 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 43 | D54C94041D094C620015B780 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | D58C7D131D0A2C750032673C /* DGThumbUpButtonUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DGThumbUpButtonUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | D58C7D1D1D0A33F60032673C /* DGExplodeAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DGExplodeAnimationView.h; path = DGThumbUpButton/DGExplodeAnimationView.h; sourceTree = ""; }; 46 | D58C7D1E1D0A33F60032673C /* DGExplodeAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DGExplodeAnimationView.m; path = DGThumbUpButton/DGExplodeAnimationView.m; sourceTree = ""; }; 47 | D58C7D1F1D0A33F60032673C /* DGThumbUpButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DGThumbUpButton.h; path = DGThumbUpButton/DGThumbUpButton.h; sourceTree = ""; }; 48 | D58C7D201D0A33F60032673C /* DGThumbUpButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DGThumbUpButton.m; path = DGThumbUpButton/DGThumbUpButton.m; sourceTree = ""; }; 49 | D58C7D241D0A38FD0032673C /* Like-Blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Like-Blue.png"; path = "Assets.xcassets/Like-Blue.imageset/Like-Blue.png"; sourceTree = ""; }; 50 | D58C7D261D0A39030032673C /* Like-PlaceHold.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Like-PlaceHold.png"; path = "Assets.xcassets/Like-PlaceHold.imageset/Like-PlaceHold.png"; sourceTree = ""; }; 51 | D58C7D281D0A39090032673C /* Like-Sparkle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Like-Sparkle.png"; path = "Assets.xcassets/Like-Sparkle.imageset/Like-Sparkle.png"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | D54C93ED1D094C620015B780 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | D58C7D101D0A2C750032673C /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | D54C93E71D094C620015B780 = { 73 | isa = PBXGroup; 74 | children = ( 75 | D54C93F21D094C620015B780 /* DGThumbUpButton */, 76 | D54C93F11D094C620015B780 /* Products */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | D54C93F11D094C620015B780 /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | D54C93F01D094C620015B780 /* DGThumbUpButton.app */, 84 | D58C7D131D0A2C750032673C /* DGThumbUpButtonUITests.xctest */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | D54C93F21D094C620015B780 /* DGThumbUpButton */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | D54C940C1D094CB90015B780 /* DGThumbUpButton */, 93 | D54C940B1D094C920015B780 /* ViewController */, 94 | D54C93FF1D094C620015B780 /* Assets.xcassets */, 95 | D54C94011D094C620015B780 /* LaunchScreen.storyboard */, 96 | D54C94041D094C620015B780 /* Info.plist */, 97 | D54C93F31D094C620015B780 /* Supporting Files */, 98 | ); 99 | path = DGThumbUpButton; 100 | sourceTree = ""; 101 | }; 102 | D54C93F31D094C620015B780 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | D54C93F41D094C620015B780 /* main.m */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | D54C940B1D094C920015B780 /* ViewController */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | D54C93F61D094C620015B780 /* AppDelegate.h */, 114 | D54C93F71D094C620015B780 /* AppDelegate.m */, 115 | D54C93F91D094C620015B780 /* ViewController.h */, 116 | D54C93FA1D094C620015B780 /* ViewController.m */, 117 | D54C93FC1D094C620015B780 /* Main.storyboard */, 118 | ); 119 | name = ViewController; 120 | sourceTree = ""; 121 | }; 122 | D54C940C1D094CB90015B780 /* DGThumbUpButton */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | D58C7D1D1D0A33F60032673C /* DGExplodeAnimationView.h */, 126 | D58C7D1E1D0A33F60032673C /* DGExplodeAnimationView.m */, 127 | D58C7D1F1D0A33F60032673C /* DGThumbUpButton.h */, 128 | D58C7D201D0A33F60032673C /* DGThumbUpButton.m */, 129 | D58C7D231D0A38DC0032673C /* Assets */, 130 | ); 131 | name = DGThumbUpButton; 132 | sourceTree = ""; 133 | }; 134 | D58C7D231D0A38DC0032673C /* Assets */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | D58C7D241D0A38FD0032673C /* Like-Blue.png */, 138 | D58C7D261D0A39030032673C /* Like-PlaceHold.png */, 139 | D58C7D281D0A39090032673C /* Like-Sparkle.png */, 140 | ); 141 | name = Assets; 142 | sourceTree = ""; 143 | }; 144 | /* End PBXGroup section */ 145 | 146 | /* Begin PBXNativeTarget section */ 147 | D54C93EF1D094C620015B780 /* DGThumbUpButton */ = { 148 | isa = PBXNativeTarget; 149 | buildConfigurationList = D54C94071D094C620015B780 /* Build configuration list for PBXNativeTarget "DGThumbUpButton" */; 150 | buildPhases = ( 151 | D54C93EC1D094C620015B780 /* Sources */, 152 | D54C93ED1D094C620015B780 /* Frameworks */, 153 | D54C93EE1D094C620015B780 /* Resources */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | ); 159 | name = DGThumbUpButton; 160 | productName = DGThumbUpButton; 161 | productReference = D54C93F01D094C620015B780 /* DGThumbUpButton.app */; 162 | productType = "com.apple.product-type.application"; 163 | }; 164 | D58C7D121D0A2C750032673C /* DGThumbUpButtonUITests */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = D58C7D1C1D0A2C750032673C /* Build configuration list for PBXNativeTarget "DGThumbUpButtonUITests" */; 167 | buildPhases = ( 168 | D58C7D0F1D0A2C750032673C /* Sources */, 169 | D58C7D101D0A2C750032673C /* Frameworks */, 170 | D58C7D111D0A2C750032673C /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | D58C7D191D0A2C750032673C /* PBXTargetDependency */, 176 | ); 177 | name = DGThumbUpButtonUITests; 178 | productName = DGThumbUpButtonUITests; 179 | productReference = D58C7D131D0A2C750032673C /* DGThumbUpButtonUITests.xctest */; 180 | productType = "com.apple.product-type.bundle.ui-testing"; 181 | }; 182 | /* End PBXNativeTarget section */ 183 | 184 | /* Begin PBXProject section */ 185 | D54C93E81D094C620015B780 /* Project object */ = { 186 | isa = PBXProject; 187 | attributes = { 188 | CLASSPREFIX = DG; 189 | LastUpgradeCheck = 0730; 190 | ORGANIZATIONNAME = Desgard_Duan; 191 | TargetAttributes = { 192 | D54C93EF1D094C620015B780 = { 193 | CreatedOnToolsVersion = 7.3.1; 194 | }; 195 | D58C7D121D0A2C750032673C = { 196 | CreatedOnToolsVersion = 7.3.1; 197 | TestTargetID = D54C93EF1D094C620015B780; 198 | }; 199 | }; 200 | }; 201 | buildConfigurationList = D54C93EB1D094C620015B780 /* Build configuration list for PBXProject "DGThumbUpButton" */; 202 | compatibilityVersion = "Xcode 3.2"; 203 | developmentRegion = English; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | Base, 208 | ); 209 | mainGroup = D54C93E71D094C620015B780; 210 | productRefGroup = D54C93F11D094C620015B780 /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | D54C93EF1D094C620015B780 /* DGThumbUpButton */, 215 | D58C7D121D0A2C750032673C /* DGThumbUpButtonUITests */, 216 | ); 217 | }; 218 | /* End PBXProject section */ 219 | 220 | /* Begin PBXResourcesBuildPhase section */ 221 | D54C93EE1D094C620015B780 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | D58C7D251D0A38FD0032673C /* Like-Blue.png in Resources */, 226 | D54C94031D094C620015B780 /* LaunchScreen.storyboard in Resources */, 227 | D58C7D271D0A39030032673C /* Like-PlaceHold.png in Resources */, 228 | D54C94001D094C620015B780 /* Assets.xcassets in Resources */, 229 | D58C7D291D0A39090032673C /* Like-Sparkle.png in Resources */, 230 | D54C93FE1D094C620015B780 /* Main.storyboard in Resources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | D58C7D111D0A2C750032673C /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXResourcesBuildPhase section */ 242 | 243 | /* Begin PBXSourcesBuildPhase section */ 244 | D54C93EC1D094C620015B780 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | D58C7D221D0A33F60032673C /* DGThumbUpButton.m in Sources */, 249 | D54C93FB1D094C620015B780 /* ViewController.m in Sources */, 250 | D54C93F81D094C620015B780 /* AppDelegate.m in Sources */, 251 | D58C7D211D0A33F60032673C /* DGExplodeAnimationView.m in Sources */, 252 | D54C93F51D094C620015B780 /* main.m in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | D58C7D0F1D0A2C750032673C /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXSourcesBuildPhase section */ 264 | 265 | /* Begin PBXTargetDependency section */ 266 | D58C7D191D0A2C750032673C /* PBXTargetDependency */ = { 267 | isa = PBXTargetDependency; 268 | target = D54C93EF1D094C620015B780 /* DGThumbUpButton */; 269 | targetProxy = D58C7D181D0A2C750032673C /* PBXContainerItemProxy */; 270 | }; 271 | /* End PBXTargetDependency section */ 272 | 273 | /* Begin PBXVariantGroup section */ 274 | D54C93FC1D094C620015B780 /* Main.storyboard */ = { 275 | isa = PBXVariantGroup; 276 | children = ( 277 | D54C93FD1D094C620015B780 /* Base */, 278 | ); 279 | name = Main.storyboard; 280 | sourceTree = ""; 281 | }; 282 | D54C94011D094C620015B780 /* LaunchScreen.storyboard */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | D54C94021D094C620015B780 /* Base */, 286 | ); 287 | name = LaunchScreen.storyboard; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | D54C94051D094C620015B780 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_ANALYZER_NONNULL = YES; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BOOL_CONVERSION = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 305 | CLANG_WARN_EMPTY_BODY = YES; 306 | CLANG_WARN_ENUM_CONVERSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | DEBUG_INFORMATION_FORMAT = dwarf; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | ENABLE_TESTABILITY = YES; 316 | GCC_C_LANGUAGE_STANDARD = gnu99; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PREPROCESSOR_DEFINITIONS = ( 321 | "DEBUG=1", 322 | "$(inherited)", 323 | ); 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | ONLY_ACTIVE_ARCH = YES; 333 | SDKROOT = iphoneos; 334 | }; 335 | name = Debug; 336 | }; 337 | D54C94061D094C620015B780 /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BOOL_CONVERSION = YES; 347 | CLANG_WARN_CONSTANT_CONVERSION = YES; 348 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 349 | CLANG_WARN_EMPTY_BODY = YES; 350 | CLANG_WARN_ENUM_CONVERSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_UNREACHABLE_CODE = YES; 354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 355 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 356 | COPY_PHASE_STRIP = NO; 357 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 358 | ENABLE_NS_ASSERTIONS = NO; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | GCC_C_LANGUAGE_STANDARD = gnu99; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 369 | MTL_ENABLE_DEBUG_INFO = NO; 370 | SDKROOT = iphoneos; 371 | VALIDATE_PRODUCT = YES; 372 | }; 373 | name = Release; 374 | }; 375 | D54C94081D094C620015B780 /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | INFOPLIST_FILE = DGThumbUpButton/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_BUNDLE_IDENTIFIER = desgard.express.DGThumbUpButton; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Debug; 385 | }; 386 | D54C94091D094C620015B780 /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 390 | INFOPLIST_FILE = DGThumbUpButton/Info.plist; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 392 | PRODUCT_BUNDLE_IDENTIFIER = desgard.express.DGThumbUpButton; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | }; 395 | name = Release; 396 | }; 397 | D58C7D1A1D0A2C750032673C /* Debug */ = { 398 | isa = XCBuildConfiguration; 399 | buildSettings = { 400 | INFOPLIST_FILE = DGThumbUpButtonUITests/Info.plist; 401 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 402 | PRODUCT_BUNDLE_IDENTIFIER = desgard.express.DGThumbUpButtonUITests; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | TEST_TARGET_NAME = DGThumbUpButton; 405 | }; 406 | name = Debug; 407 | }; 408 | D58C7D1B1D0A2C750032673C /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | INFOPLIST_FILE = DGThumbUpButtonUITests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_BUNDLE_IDENTIFIER = desgard.express.DGThumbUpButtonUITests; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | TEST_TARGET_NAME = DGThumbUpButton; 416 | }; 417 | name = Release; 418 | }; 419 | /* End XCBuildConfiguration section */ 420 | 421 | /* Begin XCConfigurationList section */ 422 | D54C93EB1D094C620015B780 /* Build configuration list for PBXProject "DGThumbUpButton" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | D54C94051D094C620015B780 /* Debug */, 426 | D54C94061D094C620015B780 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | D54C94071D094C620015B780 /* Build configuration list for PBXNativeTarget "DGThumbUpButton" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | D54C94081D094C620015B780 /* Debug */, 435 | D54C94091D094C620015B780 /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | D58C7D1C1D0A2C750032673C /* Build configuration list for PBXNativeTarget "DGThumbUpButtonUITests" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | D58C7D1A1D0A2C750032673C /* Debug */, 444 | D58C7D1B1D0A2C750032673C /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | /* End XCConfigurationList section */ 450 | }; 451 | rootObject = D54C93E81D094C620015B780 /* Project object */; 452 | } 453 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.xcworkspace/xcuserdata/Desgard_Duan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.xcworkspace/xcuserdata/Desgard_Duan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.xcworkspace/xcuserdata/developer.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/project.xcworkspace/xcuserdata/developer.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/xcuserdata/Desgard_Duan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/xcuserdata/Desgard_Duan.xcuserdatad/xcschemes/DGThumbUpButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/xcuserdata/Desgard_Duan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DGThumbUpButton.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D54C93EF1D094C620015B780 16 | 17 | primary 18 | 19 | 20 | D58C7D121D0A2C750032673C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/DGThumbUpButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DGThumbUpButton.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D54C93EF1D094C620015B780 16 | 17 | primary 18 | 19 | 20 | D58C7D121D0A2C750032673C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. 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 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. 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 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/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 | } -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Like-Blue.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Blue.imageset/Like-Blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Blue.imageset/Like-Blue.png -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-PlaceHold.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Like-PlaceHold.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-PlaceHold.imageset/Like-PlaceHold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-PlaceHold.imageset/Like-PlaceHold.png -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Sparkle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Like-Sparkle.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Sparkle.imageset/Like-Sparkle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton Objc/DGThumbUpButton/Assets.xcassets/Like-Sparkle.imageset/Like-Sparkle.png -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/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 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/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 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/DGThumbUpButton/DGExplodeAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DGExplodeAnimationView.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DGExplodeAnimationView : UIView 12 | - (void) animate; 13 | @end 14 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/DGThumbUpButton/DGExplodeAnimationView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DGExplodeAnimationView.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import "DGExplodeAnimationView.h" 10 | #import 11 | 12 | @interface DGExplodeAnimationView() 13 | 14 | @property (nonatomic, strong) CAEmitterLayer *emitterLayer; 15 | 16 | @end 17 | 18 | @implementation DGExplodeAnimationView 19 | 20 | 21 | #pragma mark - Initial Function 22 | - (void) StartUp { 23 | self.clipsToBounds = NO; 24 | self.userInteractionEnabled = NO; 25 | 26 | CAEmitterCell *emitter = [CAEmitterCell emitterCell]; 27 | 28 | emitter.contents = (id)[UIImage imageNamed: @"Like-Sparkle"].CGImage; 29 | emitter.name = @"explosion"; 30 | emitter.alphaRange = 0.2f; 31 | emitter.alphaSpeed = -1.f; 32 | emitter.lifetime = 0.7f; 33 | emitter.lifetimeRange = 0.3f; 34 | emitter.birthRate = 0; 35 | emitter.velocity = 40.0f; 36 | emitter.velocityRange = 10.0f; 37 | emitter.emissionRange = M_PI_4; 38 | emitter.scale = 0.05f; 39 | emitter.scaleRange = 0.02; 40 | 41 | _emitterLayer = [CAEmitterLayer layer]; 42 | _emitterLayer.name = @"emitterLayer"; 43 | _emitterLayer.emitterShape = kCAEmitterLayerCircle; 44 | _emitterLayer.emitterMode = kCAEmitterLayerOutline; 45 | _emitterLayer.emitterPosition = self.center; 46 | _emitterLayer.emitterSize = CGSizeMake(25, 0); 47 | _emitterLayer.renderMode = kCAEmitterLayerOldestFirst; 48 | _emitterLayer.masksToBounds = NO; 49 | _emitterLayer.emitterCells = @[emitter]; 50 | _emitterLayer.frame = [UIScreen mainScreen].bounds; 51 | 52 | [self.layer addSublayer: _emitterLayer]; 53 | 54 | 55 | _emitterLayer.emitterPosition = self.center; 56 | } 57 | 58 | #pragma mark - Overide 59 | - (void) layoutSubviews { 60 | [super layoutSubviews]; 61 | [self StartUp]; 62 | } 63 | 64 | #pragma mark - Methods 65 | - (void) animate { 66 | dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC); 67 | dispatch_after(delay, dispatch_get_main_queue(), ^{ 68 | self.emitterLayer.beginTime = CACurrentMediaTime(); 69 | CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath: @"emitterCells.explosion.birthRate"]; 70 | ani.fromValue = @0; 71 | ani.toValue = @500; 72 | [_emitterLayer addAnimation: ani forKey: nil]; 73 | }); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/DGThumbUpButton/DGThumbUpButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DGThumbUpButton.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, DGThumbUpButtonType) { 12 | DGThumbUpExplosionType = 0 13 | }; 14 | 15 | @interface DGThumbUpButton : UIButton 16 | 17 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press; 18 | - (void) clickButtonPress; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/DGThumbUpButton/DGThumbUpButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // DGThumbUpButton.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import "DGThumbUpButton.h" 10 | #import "DGExplodeAnimationView.h" 11 | 12 | @interface DGThumbUpButton() { 13 | BOOL isSelected; 14 | } 15 | 16 | @property (strong, nonatomic) DGExplodeAnimationView *explodeAnimationView; 17 | 18 | @end 19 | 20 | @implementation DGThumbUpButton 21 | 22 | 23 | #pragma mark - Freedom Initial 24 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press type: (DGThumbUpButtonType)type { 25 | self = [super initWithFrame: frame]; 26 | isSelected = press; 27 | if (isSelected) { 28 | [self setImage: [UIImage imageNamed: @"Like-Blue"] forState: UIControlStateNormal]; 29 | } else { 30 | [self setImage: [UIImage imageNamed: @"Like-PlaceHold"] forState: UIControlStateNormal]; 31 | } 32 | 33 | [self addTarget: self 34 | action: @selector(clickButtonPress) 35 | forControlEvents: UIControlEventTouchUpInside]; 36 | 37 | [self insertSubview: self.explodeAnimationView atIndex: 0]; 38 | 39 | return self; 40 | } 41 | 42 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press { 43 | self = [self initWithFrame: frame 44 | isPress: press 45 | type: DGThumbUpExplosionType]; 46 | return self; 47 | } 48 | 49 | #pragma mark - Override 50 | - (instancetype) initWithFrame: (CGRect) frame { 51 | self = [self initWithFrame: frame 52 | isPress: NO 53 | type: DGThumbUpExplosionType]; 54 | return self; 55 | } 56 | 57 | - (instancetype) init { 58 | self = [self initWithFrame: CGRectMake(0, 0, 30, 30) 59 | isPress: NO 60 | type: DGThumbUpExplosionType]; 61 | return self; 62 | } 63 | 64 | - (void) layoutSubviews { 65 | [super layoutSubviews]; 66 | } 67 | 68 | #pragma mark - Methods 69 | - (void) clickButtonPress { 70 | if (isSelected) [self popInsideWithDuration: 0.5]; 71 | else { 72 | [self popOutsideWithDuration: 0.5]; 73 | [self.explodeAnimationView animate]; 74 | }; 75 | } 76 | 77 | - (void) popOutsideWithDuration: (NSTimeInterval) duringTime { 78 | __weak typeof(self) weakSelf = self; 79 | self.transform = CGAffineTransformIdentity; 80 | 81 | [UIView animateKeyframesWithDuration: duringTime delay: 0 options: 0 animations: ^{ 82 | [weakSelf setImage: [UIImage imageNamed: @"Like-Blue"] forState: UIControlStateNormal]; 83 | [UIView addKeyframeWithRelativeStartTime: 0 84 | relativeDuration: 1 / 3.0 85 | animations: ^{ 86 | typeof(self) strongSelf = weakSelf; 87 | strongSelf.transform = CGAffineTransformMakeScale(1.5, 1.5); 88 | }]; 89 | [UIView addKeyframeWithRelativeStartTime: 1 / 3.0 90 | relativeDuration: 1 / 3.0 91 | animations: ^{ 92 | typeof(self) strongSelf = weakSelf; 93 | strongSelf.transform = CGAffineTransformMakeScale(0.8, 0.8); 94 | }]; 95 | [UIView addKeyframeWithRelativeStartTime: 2 / 3.0 96 | relativeDuration: 1 / 3.0 97 | animations: ^{ 98 | typeof(self) strongSelf = weakSelf; 99 | strongSelf.transform = CGAffineTransformMakeScale(1.0, 1.0); 100 | }]; 101 | } completion: ^(BOOL finished) { 102 | isSelected = YES; 103 | }]; 104 | } 105 | 106 | - (void) popInsideWithDuration: (NSTimeInterval) duringTime { 107 | __weak typeof(self) weakSelf = self; 108 | self.transform = CGAffineTransformIdentity; 109 | 110 | [UIView animateKeyframesWithDuration: duringTime delay: 0 options: 0 animations: ^{ 111 | [weakSelf setImage: [UIImage imageNamed: @"Like-PlaceHold"] forState: UIControlStateNormal]; 112 | [UIView addKeyframeWithRelativeStartTime: 0 113 | relativeDuration: 1 / 2.0 114 | animations: ^{ 115 | typeof(self) strongSelf = weakSelf; 116 | strongSelf.transform = CGAffineTransformMakeScale(0.8, 0.8); 117 | }]; 118 | [UIView addKeyframeWithRelativeStartTime: 1 / 2.0 119 | relativeDuration: 1 / 2.0 120 | animations: ^{ 121 | typeof(self) strongSelf = weakSelf; 122 | strongSelf.transform = CGAffineTransformMakeScale(1.0, 1.0); 123 | }]; 124 | } completion: ^(BOOL finished) { 125 | isSelected = NO; 126 | }]; 127 | 128 | } 129 | 130 | #pragma mark - Lazy Init 131 | - (DGExplodeAnimationView *) explodeAnimationView { 132 | if (!_explodeAnimationView) { 133 | _explodeAnimationView = [[DGExplodeAnimationView alloc] initWithFrame: self.bounds]; 134 | } 135 | return _explodeAnimationView; 136 | } 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/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 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DGThumbUpButton.h" 11 | 12 | 13 | @interface ViewController () 14 | 15 | @property (strong, nonatomic) DGThumbUpButton *ThumbUpButton; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | DGThumbUpButton *thumbUpButton = [[DGThumbUpButton alloc] init]; 24 | thumbUpButton.center = self.view.center; 25 | 26 | [self.view addSubview: thumbUpButton]; 27 | 28 | } 29 | 30 | - (void) clickButtonPress { 31 | 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /DGThumbUpButton Objc/DGThumbUpButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. 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 | -------------------------------------------------------------------------------- /DGThumbUpButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "DGThumbUpButton" 3 | s.version = "0.0.2" 4 | s.summary = "Like Button With Explosion Effect" 5 | 6 | s.description = <<-DESC 7 | Like Button With Explosion Effect. 8 | DESC 9 | s.homepage = "https://github.com/dgytdhy/DGThumbUpButton" 10 | s.license = "MIT" 11 | s.author = { "Desgard_Duan" => "desgard_duan@foxmail.com" } 12 | s.source = { :git => "https://github.com/dgytdhy/DGThumbUpButton.git", :tag => "0.0.2" } 13 | s.platform = :ios, "5.0" 14 | s.source_files = 'DGThumbUpButton/*.{m,h}' 15 | s.resource_bundles = { 16 | 'DGThumbUpButton' => ['DGThumbUpButton/*.png'] 17 | } 18 | s.exclude_files = 'Classes/Exclude' 19 | s.framework = 'UIKit' 20 | s.requires_arc = true 21 | end 22 | -------------------------------------------------------------------------------- /DGThumbUpButton/DGExplodeAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DGExplodeAnimationView.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DGExplodeAnimationView : UIView 12 | - (void) animate; 13 | @end 14 | -------------------------------------------------------------------------------- /DGThumbUpButton/DGExplodeAnimationView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DGExplodeAnimationView.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import "DGExplodeAnimationView.h" 10 | #import 11 | 12 | @interface DGExplodeAnimationView() 13 | 14 | @property (nonatomic, strong) CAEmitterLayer *emitterLayer; 15 | 16 | @end 17 | 18 | @implementation DGExplodeAnimationView 19 | 20 | 21 | #pragma mark - Initial Function 22 | - (void) StartUp { 23 | self.clipsToBounds = NO; 24 | self.userInteractionEnabled = NO; 25 | 26 | CAEmitterCell *emitter = [CAEmitterCell emitterCell]; 27 | 28 | emitter.contents = (id)[UIImage imageNamed: @"Like-Sparkle.png"].CGImage; 29 | emitter.name = @"explosion"; 30 | emitter.alphaRange = 0.2f; 31 | emitter.alphaSpeed = -1.f; 32 | emitter.lifetime = 0.7f; 33 | emitter.lifetimeRange = 0.3f; 34 | emitter.birthRate = 0; 35 | emitter.velocity = 40.0f; 36 | emitter.velocityRange = 10.0f; 37 | emitter.emissionRange = M_PI_4; 38 | emitter.scale = 0.05f; 39 | emitter.scaleRange = 0.02; 40 | 41 | _emitterLayer = [CAEmitterLayer layer]; 42 | _emitterLayer.name = @"emitterLayer"; 43 | _emitterLayer.emitterShape = kCAEmitterLayerCircle; 44 | _emitterLayer.emitterMode = kCAEmitterLayerOutline; 45 | _emitterLayer.emitterPosition = self.center; 46 | _emitterLayer.emitterSize = CGSizeMake(25, 0); 47 | _emitterLayer.renderMode = kCAEmitterLayerOldestFirst; 48 | _emitterLayer.masksToBounds = NO; 49 | _emitterLayer.emitterCells = @[emitter]; 50 | _emitterLayer.frame = [UIScreen mainScreen].bounds; 51 | 52 | [self.layer addSublayer: _emitterLayer]; 53 | 54 | 55 | _emitterLayer.emitterPosition = self.center; 56 | } 57 | 58 | #pragma mark - Overide 59 | - (void) layoutSubviews { 60 | [super layoutSubviews]; 61 | [self StartUp]; 62 | } 63 | 64 | #pragma mark - Methods 65 | - (void) animate { 66 | dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC); 67 | dispatch_after(delay, dispatch_get_main_queue(), ^{ 68 | self.emitterLayer.beginTime = CACurrentMediaTime(); 69 | CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath: @"emitterCells.explosion.birthRate"]; 70 | ani.fromValue = @0; 71 | ani.toValue = @500; 72 | [_emitterLayer addAnimation: ani forKey: nil]; 73 | }); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /DGThumbUpButton/DGThumbUpButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DGThumbUpButton.h 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, DGThumbUpButtonType) { 12 | DGThumbUpExplosionType = 0 13 | }; 14 | 15 | @interface DGThumbUpButton : UIButton 16 | 17 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press; 18 | - (void) clickButtonPress; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DGThumbUpButton/DGThumbUpButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // DGThumbUpButton.m 3 | // DGThumbUpButton 4 | // 5 | // Created by Desgard_Duan on 16/6/9. 6 | // Copyright © 2016年 Desgard_Duan. All rights reserved. 7 | // 8 | 9 | #import "DGThumbUpButton.h" 10 | #import "DGExplodeAnimationView.h" 11 | 12 | @interface DGThumbUpButton() { 13 | BOOL isSelected; 14 | } 15 | 16 | @property (strong, nonatomic) DGExplodeAnimationView *explodeAnimationView; 17 | 18 | @end 19 | 20 | @implementation DGThumbUpButton 21 | 22 | 23 | #pragma mark - Freedom Initial 24 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press type: (DGThumbUpButtonType)type { 25 | self = [super initWithFrame: frame]; 26 | isSelected = press; 27 | if (isSelected) { 28 | [self setImage: [UIImage imageNamed: @"Like-Blue.png"] forState: UIControlStateNormal]; 29 | } else { 30 | [self setImage: [UIImage imageNamed: @"Like-PlaceHold.png"] forState: UIControlStateNormal]; 31 | } 32 | 33 | [self addTarget: self 34 | action: @selector(clickButtonPress) 35 | forControlEvents: UIControlEventTouchUpInside]; 36 | 37 | [self insertSubview: self.explodeAnimationView atIndex: 0]; 38 | 39 | return self; 40 | } 41 | 42 | - (instancetype) initWithFrame: (CGRect)frame isPress: (BOOL)press { 43 | self = [self initWithFrame: frame 44 | isPress: press 45 | type: DGThumbUpExplosionType]; 46 | return self; 47 | } 48 | 49 | #pragma mark - Override 50 | - (instancetype) initWithFrame: (CGRect) frame { 51 | self = [self initWithFrame: frame 52 | isPress: NO 53 | type: DGThumbUpExplosionType]; 54 | return self; 55 | } 56 | 57 | - (instancetype) init { 58 | self = [self initWithFrame: CGRectMake(0, 0, 30, 30) 59 | isPress: NO 60 | type: DGThumbUpExplosionType]; 61 | return self; 62 | } 63 | 64 | - (void) layoutSubviews { 65 | [super layoutSubviews]; 66 | } 67 | 68 | #pragma mark - Methods 69 | - (void) clickButtonPress { 70 | if (isSelected) [self popInsideWithDuration: 0.5]; 71 | else { 72 | [self popOutsideWithDuration: 0.5]; 73 | [self.explodeAnimationView animate]; 74 | }; 75 | } 76 | 77 | - (void) popOutsideWithDuration: (NSTimeInterval) duringTime { 78 | __weak typeof(self) weakSelf = self; 79 | self.transform = CGAffineTransformIdentity; 80 | 81 | [UIView animateKeyframesWithDuration: duringTime delay: 0 options: 0 animations: ^{ 82 | [weakSelf setImage: [UIImage imageNamed: @"Like-Blue.png"] forState: UIControlStateNormal]; 83 | [UIView addKeyframeWithRelativeStartTime: 0 84 | relativeDuration: 1 / 3.0 85 | animations: ^{ 86 | typeof(self) strongSelf = weakSelf; 87 | strongSelf.transform = CGAffineTransformMakeScale(1.5, 1.5); 88 | }]; 89 | [UIView addKeyframeWithRelativeStartTime: 1 / 3.0 90 | relativeDuration: 1 / 3.0 91 | animations: ^{ 92 | typeof(self) strongSelf = weakSelf; 93 | strongSelf.transform = CGAffineTransformMakeScale(0.8, 0.8); 94 | }]; 95 | [UIView addKeyframeWithRelativeStartTime: 2 / 3.0 96 | relativeDuration: 1 / 3.0 97 | animations: ^{ 98 | typeof(self) strongSelf = weakSelf; 99 | strongSelf.transform = CGAffineTransformMakeScale(1.0, 1.0); 100 | }]; 101 | } completion: ^(BOOL finished) { 102 | isSelected = YES; 103 | }]; 104 | } 105 | 106 | - (void) popInsideWithDuration: (NSTimeInterval) duringTime { 107 | __weak typeof(self) weakSelf = self; 108 | self.transform = CGAffineTransformIdentity; 109 | 110 | [UIView animateKeyframesWithDuration: duringTime delay: 0 options: 0 animations: ^{ 111 | [weakSelf setImage: [UIImage imageNamed: @"Like-PlaceHold.png"] forState: UIControlStateNormal]; 112 | [UIView addKeyframeWithRelativeStartTime: 0 113 | relativeDuration: 1 / 2.0 114 | animations: ^{ 115 | typeof(self) strongSelf = weakSelf; 116 | strongSelf.transform = CGAffineTransformMakeScale(0.8, 0.8); 117 | }]; 118 | [UIView addKeyframeWithRelativeStartTime: 1 / 2.0 119 | relativeDuration: 1 / 2.0 120 | animations: ^{ 121 | typeof(self) strongSelf = weakSelf; 122 | strongSelf.transform = CGAffineTransformMakeScale(1.0, 1.0); 123 | }]; 124 | } completion: ^(BOOL finished) { 125 | isSelected = NO; 126 | }]; 127 | 128 | } 129 | 130 | #pragma mark - Lazy Init 131 | - (DGExplodeAnimationView *) explodeAnimationView { 132 | if (!_explodeAnimationView) { 133 | _explodeAnimationView = [[DGExplodeAnimationView alloc] initWithFrame: self.bounds]; 134 | } 135 | return _explodeAnimationView; 136 | } 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /DGThumbUpButton/Like-Blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton/Like-Blue.png -------------------------------------------------------------------------------- /DGThumbUpButton/Like-PlaceHold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton/Like-PlaceHold.png -------------------------------------------------------------------------------- /DGThumbUpButton/Like-Sparkle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/DGThumbUpButton/Like-Sparkle.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Desgard_Duan 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 | DGThumbUpButton 2 | ============= 3 | 4 | [![Build Status](https://travis-ci.org/scalessec/Toast.svg?branch=3.0)]() [![CocoaPods Version](https://img.shields.io/cocoapods/v/Toast.svg)]() [![apm](https://img.shields.io/apm/l/vim-mode.svg?maxAge=2592000)]() 5 | ========= 6 | 7 | ## Description 8 | 9 | Drop-in button control with with particle effects similar to the Like button in Facebook Paper. 10 | 11 | 带有粒子扩散效果的点赞按钮,模仿Facebook Paper中的Like Button。实现思路可以查看我的博文:[If you like me, Thumb Up!](http://desgard.com/2016/06/09/DGThumbUpButton/)。喜欢的话可以Star下✨。 12 | 13 | ## Screenshot 14 | 15 | ![](Source/demo0.gif) 16 | 17 | ## Setup 18 | 19 | Install with [CocoaPods](http://cocoapods.org) by adding the following to your Podfile: 20 | 21 | ``` ruby 22 | platform :ios, '5.0' 23 | pod 'DGThumbUpButton', '~> 0.0.1' 24 | ``` 25 | 26 | or add manually: 27 | 28 | Add `DGThumbUpButton.h` to your project. 29 | 30 | ## Basic Examples 31 | 32 | ```objc 33 | DGThumbUpButton *btn = [[DGThumbUpButton alloc] init]; 34 | [self.view addSubview: btn]; 35 | ``` 36 | ## Q&A 37 | 38 | Q: I use CocoaPods to setup the `DGThumbUpButton`, and I write code as Basic Examples, but I can't get a Button in the View. 39 | 40 | A: When I test CocoaPods, I found this situation. I advise to move `.png` files in `Assets.xcassets` 41 | 42 | ```shell 43 | . 44 | ├── Podfile 45 | ├── Podfile.lock 46 | ├── Pods 47 | │   ├── DGThumbUpButton 48 | │   │   ├── DGThumbUpButton 49 | │   │   │   ├── DGExplodeAnimationView.h 50 | │   │   │   ├── DGExplodeAnimationView.m 51 | │   │   │   ├── DGThumbUpButton.h 52 | │   │   │   ├── DGThumbUpButton.m 53 | │   │   │   ├── Like-Blue.png 54 | │   │   │   ├── Like-PlaceHold.png 55 | │   │   │   └── Like-Sparkle.png 56 |        57 | ``` 58 | 59 | And change all `Like-Blue.png`, `Like-PlaceHold.png` and `Like-Sparkle.png` files' name to your custom image set name in your `Assets.xcassets`. 60 | 61 | ## License 62 | 63 | DGThumbUpButton is under the MIT license. 64 | -------------------------------------------------------------------------------- /Source/demo0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Desgard/DGThumbUpButton/e39039a459958fe84bd2e3de2e569c51503f72ed/Source/demo0.gif --------------------------------------------------------------------------------