├── .travis.yml ├── CatZanButton.podspec ├── CatZanButton.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── CatZanButton.xccheckout │ └── xcuserdata │ │ └── K-cat.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── xcschemes │ │ └── CatZanButton.xcscheme └── xcuserdata │ └── K-cat.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── CatZanButton ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── CatZanButton │ ├── CatZanButton.h │ ├── CatZanButton.m │ ├── EffectImage.png │ ├── UnZan.png │ └── Zan.png ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── CatZanButtonTests ├── CatZanButtonTests.m └── Info.plist ├── LICENSE ├── README.md └── ScreenRecord.gif /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | before_install: 3 | - brew update 4 | - brew reinstall xctool 5 | xcode_project: CatZanButton.xcodeproj 6 | xcode_scheme: CatZanButton 7 | xcode_sdk: 8 | - iphonesimulator 9 | - iphonesimulator8.1 -------------------------------------------------------------------------------- /CatZanButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "CatZanButton" 4 | s.version = "1.2.2" 5 | s.summary = "A animation button for Zan." 6 | s.homepage = "https://github.com/K-cat/CatZanButton" 7 | s.license = "MIT" 8 | s.author = { "K-cat" => "kcatismyname@icloud.com" } 9 | s.ios.deployment_target = "5.0" 10 | s.source = { :git => "https://github.com/K-cat/CatZanButton.git", :tag => "#{s.version}" } 11 | s.source_files = "CatZanButton/CatZanButton/*.{h,m}" 12 | s.resource = "CatZanButton/CatZanButton/*.png" 13 | s.frameworks = "UIKit", "QuartzCore" 14 | s.requires_arc = true 15 | end 16 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D07D1C6A1B58DE71002B5732 /* UnZan.png in Resources */ = {isa = PBXBuildFile; fileRef = D07D1C681B58DE71002B5732 /* UnZan.png */; }; 11 | D07D1C6B1B58DE71002B5732 /* Zan.png in Resources */ = {isa = PBXBuildFile; fileRef = D07D1C691B58DE71002B5732 /* Zan.png */; }; 12 | D0D70B0C1B5360B900889677 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D70B0B1B5360B900889677 /* main.m */; }; 13 | D0D70B0F1B5360B900889677 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D70B0E1B5360B900889677 /* AppDelegate.m */; }; 14 | D0D70B121B5360B900889677 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D70B111B5360B900889677 /* ViewController.m */; }; 15 | D0D70B151B5360B900889677 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D0D70B131B5360B900889677 /* Main.storyboard */; }; 16 | D0D70B171B5360B900889677 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D0D70B161B5360B900889677 /* Images.xcassets */; }; 17 | D0D70B261B5360B900889677 /* CatZanButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D70B251B5360B900889677 /* CatZanButtonTests.m */; }; 18 | D0D70B321B5361AA00889677 /* CatZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D70B311B5361AA00889677 /* CatZanButton.m */; }; 19 | D0D70B381B53975000889677 /* EffectImage.png in Resources */ = {isa = PBXBuildFile; fileRef = D0D70B371B53975000889677 /* EffectImage.png */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | D0D70B201B5360B900889677 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = D0D70AFE1B5360B900889677 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = D0D70B051B5360B900889677; 28 | remoteInfo = CatZanButton; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | D07D1C681B58DE71002B5732 /* UnZan.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UnZan.png; path = CatZanButton/UnZan.png; sourceTree = ""; }; 34 | D07D1C691B58DE71002B5732 /* Zan.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Zan.png; path = CatZanButton/Zan.png; sourceTree = ""; }; 35 | D0D70B061B5360B900889677 /* CatZanButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CatZanButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | D0D70B0A1B5360B900889677 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | D0D70B0B1B5360B900889677 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | D0D70B0D1B5360B900889677 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | D0D70B0E1B5360B900889677 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | D0D70B101B5360B900889677 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 41 | D0D70B111B5360B900889677 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 42 | D0D70B141B5360B900889677 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | D0D70B161B5360B900889677 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 44 | D0D70B1F1B5360B900889677 /* CatZanButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CatZanButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | D0D70B241B5360B900889677 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | D0D70B251B5360B900889677 /* CatZanButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CatZanButtonTests.m; sourceTree = ""; }; 47 | D0D70B301B5361AA00889677 /* CatZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CatZanButton.h; path = CatZanButton/CatZanButton.h; sourceTree = ""; }; 48 | D0D70B311B5361AA00889677 /* CatZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CatZanButton.m; path = CatZanButton/CatZanButton.m; sourceTree = ""; }; 49 | D0D70B371B53975000889677 /* EffectImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = EffectImage.png; path = CatZanButton/EffectImage.png; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | D0D70B031B5360B900889677 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | D0D70B1C1B5360B900889677 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | D0D70AFD1B5360B900889677 = { 71 | isa = PBXGroup; 72 | children = ( 73 | D0D70B081B5360B900889677 /* CatZanButton */, 74 | D0D70B221B5360B900889677 /* CatZanButtonTests */, 75 | D0D70B071B5360B900889677 /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | D0D70B071B5360B900889677 /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | D0D70B061B5360B900889677 /* CatZanButton.app */, 83 | D0D70B1F1B5360B900889677 /* CatZanButtonTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | D0D70B081B5360B900889677 /* CatZanButton */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | D0D70B2F1B5360C700889677 /* CatZanButton */, 92 | D0D70B0D1B5360B900889677 /* AppDelegate.h */, 93 | D0D70B0E1B5360B900889677 /* AppDelegate.m */, 94 | D0D70B101B5360B900889677 /* ViewController.h */, 95 | D0D70B111B5360B900889677 /* ViewController.m */, 96 | D0D70B131B5360B900889677 /* Main.storyboard */, 97 | D0D70B161B5360B900889677 /* Images.xcassets */, 98 | D0D70B091B5360B900889677 /* Supporting Files */, 99 | ); 100 | path = CatZanButton; 101 | sourceTree = ""; 102 | }; 103 | D0D70B091B5360B900889677 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | D0D70B0A1B5360B900889677 /* Info.plist */, 107 | D0D70B0B1B5360B900889677 /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | D0D70B221B5360B900889677 /* CatZanButtonTests */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | D0D70B251B5360B900889677 /* CatZanButtonTests.m */, 116 | D0D70B231B5360B900889677 /* Supporting Files */, 117 | ); 118 | path = CatZanButtonTests; 119 | sourceTree = ""; 120 | }; 121 | D0D70B231B5360B900889677 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | D0D70B241B5360B900889677 /* Info.plist */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | D0D70B2F1B5360C700889677 /* CatZanButton */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | D0D70B301B5361AA00889677 /* CatZanButton.h */, 133 | D0D70B311B5361AA00889677 /* CatZanButton.m */, 134 | D0D70B371B53975000889677 /* EffectImage.png */, 135 | D07D1C681B58DE71002B5732 /* UnZan.png */, 136 | D07D1C691B58DE71002B5732 /* Zan.png */, 137 | ); 138 | name = CatZanButton; 139 | sourceTree = ""; 140 | }; 141 | /* End PBXGroup section */ 142 | 143 | /* Begin PBXNativeTarget section */ 144 | D0D70B051B5360B900889677 /* CatZanButton */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = D0D70B291B5360B900889677 /* Build configuration list for PBXNativeTarget "CatZanButton" */; 147 | buildPhases = ( 148 | D0D70B021B5360B900889677 /* Sources */, 149 | D0D70B031B5360B900889677 /* Frameworks */, 150 | D0D70B041B5360B900889677 /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = CatZanButton; 157 | productName = CatZanButton; 158 | productReference = D0D70B061B5360B900889677 /* CatZanButton.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | D0D70B1E1B5360B900889677 /* CatZanButtonTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = D0D70B2C1B5360B900889677 /* Build configuration list for PBXNativeTarget "CatZanButtonTests" */; 164 | buildPhases = ( 165 | D0D70B1B1B5360B900889677 /* Sources */, 166 | D0D70B1C1B5360B900889677 /* Frameworks */, 167 | D0D70B1D1B5360B900889677 /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | D0D70B211B5360B900889677 /* PBXTargetDependency */, 173 | ); 174 | name = CatZanButtonTests; 175 | productName = CatZanButtonTests; 176 | productReference = D0D70B1F1B5360B900889677 /* CatZanButtonTests.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | D0D70AFE1B5360B900889677 /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastUpgradeCheck = 0640; 186 | ORGANIZATIONNAME = "K-cat"; 187 | TargetAttributes = { 188 | D0D70B051B5360B900889677 = { 189 | CreatedOnToolsVersion = 6.4; 190 | }; 191 | D0D70B1E1B5360B900889677 = { 192 | CreatedOnToolsVersion = 6.4; 193 | TestTargetID = D0D70B051B5360B900889677; 194 | }; 195 | }; 196 | }; 197 | buildConfigurationList = D0D70B011B5360B900889677 /* Build configuration list for PBXProject "CatZanButton" */; 198 | compatibilityVersion = "Xcode 3.2"; 199 | developmentRegion = English; 200 | hasScannedForEncodings = 0; 201 | knownRegions = ( 202 | en, 203 | Base, 204 | ); 205 | mainGroup = D0D70AFD1B5360B900889677; 206 | productRefGroup = D0D70B071B5360B900889677 /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | D0D70B051B5360B900889677 /* CatZanButton */, 211 | D0D70B1E1B5360B900889677 /* CatZanButtonTests */, 212 | ); 213 | }; 214 | /* End PBXProject section */ 215 | 216 | /* Begin PBXResourcesBuildPhase section */ 217 | D0D70B041B5360B900889677 /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | D07D1C6A1B58DE71002B5732 /* UnZan.png in Resources */, 222 | D0D70B151B5360B900889677 /* Main.storyboard in Resources */, 223 | D07D1C6B1B58DE71002B5732 /* Zan.png in Resources */, 224 | D0D70B381B53975000889677 /* EffectImage.png in Resources */, 225 | D0D70B171B5360B900889677 /* Images.xcassets in Resources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | D0D70B1D1B5360B900889677 /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | D0D70B021B5360B900889677 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | D0D70B121B5360B900889677 /* ViewController.m in Sources */, 244 | D0D70B0F1B5360B900889677 /* AppDelegate.m in Sources */, 245 | D0D70B321B5361AA00889677 /* CatZanButton.m in Sources */, 246 | D0D70B0C1B5360B900889677 /* main.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | D0D70B1B1B5360B900889677 /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | D0D70B261B5360B900889677 /* CatZanButtonTests.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | D0D70B211B5360B900889677 /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = D0D70B051B5360B900889677 /* CatZanButton */; 264 | targetProxy = D0D70B201B5360B900889677 /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | D0D70B131B5360B900889677 /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | D0D70B141B5360B900889677 /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | D0D70B271B5360B900889677 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | }; 322 | name = Debug; 323 | }; 324 | D0D70B281B5360B900889677 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Release; 361 | }; 362 | D0D70B2A1B5360B900889677 /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 367 | INFOPLIST_FILE = CatZanButton/Info.plist; 368 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | }; 372 | name = Debug; 373 | }; 374 | D0D70B2B1B5360B900889677 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 379 | INFOPLIST_FILE = CatZanButton/Info.plist; 380 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Release; 385 | }; 386 | D0D70B2D1B5360B900889677 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | BUNDLE_LOADER = "$(TEST_HOST)"; 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(SDKROOT)/Developer/Library/Frameworks", 392 | "$(inherited)", 393 | ); 394 | GCC_PREPROCESSOR_DEFINITIONS = ( 395 | "DEBUG=1", 396 | "$(inherited)", 397 | ); 398 | INFOPLIST_FILE = CatZanButtonTests/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CatZanButton.app/CatZanButton"; 402 | }; 403 | name = Debug; 404 | }; 405 | D0D70B2E1B5360B900889677 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | BUNDLE_LOADER = "$(TEST_HOST)"; 409 | FRAMEWORK_SEARCH_PATHS = ( 410 | "$(SDKROOT)/Developer/Library/Frameworks", 411 | "$(inherited)", 412 | ); 413 | INFOPLIST_FILE = CatZanButtonTests/Info.plist; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 415 | PRODUCT_NAME = "$(TARGET_NAME)"; 416 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CatZanButton.app/CatZanButton"; 417 | }; 418 | name = Release; 419 | }; 420 | /* End XCBuildConfiguration section */ 421 | 422 | /* Begin XCConfigurationList section */ 423 | D0D70B011B5360B900889677 /* Build configuration list for PBXProject "CatZanButton" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | D0D70B271B5360B900889677 /* Debug */, 427 | D0D70B281B5360B900889677 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | D0D70B291B5360B900889677 /* Build configuration list for PBXNativeTarget "CatZanButton" */ = { 433 | isa = XCConfigurationList; 434 | buildConfigurations = ( 435 | D0D70B2A1B5360B900889677 /* Debug */, 436 | D0D70B2B1B5360B900889677 /* Release */, 437 | ); 438 | defaultConfigurationIsVisible = 0; 439 | defaultConfigurationName = Release; 440 | }; 441 | D0D70B2C1B5360B900889677 /* Build configuration list for PBXNativeTarget "CatZanButtonTests" */ = { 442 | isa = XCConfigurationList; 443 | buildConfigurations = ( 444 | D0D70B2D1B5360B900889677 /* Debug */, 445 | D0D70B2E1B5360B900889677 /* Release */, 446 | ); 447 | defaultConfigurationIsVisible = 0; 448 | defaultConfigurationName = Release; 449 | }; 450 | /* End XCConfigurationList section */ 451 | }; 452 | rootObject = D0D70AFE1B5360B900889677 /* Project object */; 453 | } 454 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/project.xcworkspace/xcshareddata/CatZanButton.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | E13536B1-C60A-490A-A88B-131C3738EBF7 9 | IDESourceControlProjectName 10 | CatZanButton 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 6BAA1E74F97ABF17641D4DC3E3F3A1E9510C5495 14 | https://github.com/K-cat/CatZanButton.git 15 | 16 | IDESourceControlProjectPath 17 | CatZanButton.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 6BAA1E74F97ABF17641D4DC3E3F3A1E9510C5495 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/K-cat/CatZanButton.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 6BAA1E74F97ABF17641D4DC3E3F3A1E9510C5495 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 6BAA1E74F97ABF17641D4DC3E3F3A1E9510C5495 36 | IDESourceControlWCCName 37 | CatZanButton 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/project.xcworkspace/xcuserdata/K-cat.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imkcat/CatZanButton/7a71eb36ea3d5121fa61b8b51970abdca1284e86/CatZanButton.xcodeproj/project.xcworkspace/xcuserdata/K-cat.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/xcshareddata/xcschemes/CatZanButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/xcuserdata/K-cat.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CatZanButton.xcodeproj/xcuserdata/K-cat.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CatZanButton.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D0D70B051B5360B900889677 16 | 17 | primary 18 | 19 | 20 | D0D70B1E1B5360B900889677 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CatZanButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. 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 | -------------------------------------------------------------------------------- /CatZanButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. 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 | -------------------------------------------------------------------------------- /CatZanButton/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 | -------------------------------------------------------------------------------- /CatZanButton/CatZanButton/CatZanButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // CatZanButton.h 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | typedef NS_ENUM(NSInteger, CatZanButtonType) { 13 | CatZanButtonTypeFirework, 14 | CatZanButtonTypeFocus 15 | }; 16 | 17 | @interface CatZanButton : UIControl 18 | 19 | /** 20 | * A bool value for button current status 21 | */ 22 | @property (nonatomic) BOOL isZan; 23 | 24 | /** 25 | * A enum for button animation type 26 | */ 27 | @property (nonatomic) CatZanButtonType type; 28 | 29 | /** 30 | * A handler for click button action 31 | */ 32 | @property (nonatomic, copy) void (^clickHandler)(CatZanButton *zanButton); 33 | 34 | /** 35 | * Initializes a new CatZanButton with appoint properties 36 | * 37 | * @param frame Button frame 38 | * @param zanImage Image for button active status 39 | * @param unZanIamge Image for button inactive status 40 | * 41 | * @return New CatZanButton object 42 | */ 43 | -(instancetype)initWithFrame:(CGRect)frame zanImage:(UIImage *)zanImage unZanImage:(UIImage *)unZanIamge; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CatZanButton/CatZanButton/CatZanButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // CatZanButton.m 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. All rights reserved. 7 | // 8 | 9 | #import "CatZanButton.h" 10 | 11 | @interface CatZanButton (){ 12 | UIImageView *_zanImageView; 13 | CAEmitterLayer *_effectLayer; 14 | CAEmitterCell *_effectCell; 15 | UIImage *_zanImage; 16 | UIImage *_unZanImage; 17 | } 18 | 19 | @end 20 | 21 | @implementation CatZanButton 22 | 23 | -(instancetype)init{ 24 | self=[super init]; 25 | if (self) { 26 | [self setFrame:CGRectMake(0, 0, 30, 30)]; 27 | _zanImage=[UIImage imageNamed:@"Zan"]; 28 | _unZanImage=[UIImage imageNamed:@"UnZan"]; 29 | _type=CatZanButtonTypeFirework; 30 | [self initBaseLayout]; 31 | } 32 | return self; 33 | } 34 | 35 | -(instancetype)initWithFrame:(CGRect)frame{ 36 | self=[super initWithFrame:frame]; 37 | if (self) { 38 | _zanImage=[UIImage imageNamed:@"Zan"]; 39 | _unZanImage=[UIImage imageNamed:@"UnZan"]; 40 | _type=CatZanButtonTypeFirework; 41 | [self initBaseLayout]; 42 | } 43 | return self; 44 | } 45 | 46 | -(instancetype)initWithFrame:(CGRect)frame zanImage:(UIImage *)zanImage unZanImage:(UIImage *)unZanIamge{ 47 | self=[super initWithFrame:frame]; 48 | if (self) { 49 | _zanImage=zanImage; 50 | _unZanImage=unZanIamge; 51 | _type=CatZanButtonTypeFirework; 52 | [self initBaseLayout]; 53 | } 54 | return self; 55 | } 56 | 57 | /** 58 | * Init base layout 59 | */ 60 | -(void)initBaseLayout{ 61 | _isZan=NO; 62 | 63 | switch (_type) { 64 | case CatZanButtonTypeFirework:{ 65 | _effectLayer=[CAEmitterLayer layer]; 66 | [_effectLayer setFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 67 | [self.layer addSublayer:_effectLayer]; 68 | [_effectLayer setEmitterShape:kCAEmitterLayerCircle]; 69 | [_effectLayer setEmitterMode:kCAEmitterLayerOutline]; 70 | [_effectLayer setEmitterPosition:CGPointMake(CGRectGetWidth(self.frame)/2, CGRectGetHeight(self.frame)/2)]; 71 | [_effectLayer setEmitterSize:CGSizeMake(CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 72 | 73 | _effectCell=[CAEmitterCell emitterCell]; 74 | [_effectCell setName:@"zanShape"]; 75 | [_effectCell setContents:(__bridge id)[UIImage imageNamed:@"EffectImage"].CGImage]; 76 | [_effectCell setAlphaSpeed:-1.0f]; 77 | [_effectCell setLifetime:1.0f]; 78 | [_effectCell setBirthRate:0]; 79 | [_effectCell setVelocity:50]; 80 | [_effectCell setVelocityRange:50]; 81 | 82 | [_effectLayer setEmitterCells:@[_effectCell]]; 83 | 84 | _zanImageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 85 | [_zanImageView setImage:_unZanImage]; 86 | [_zanImageView setUserInteractionEnabled:YES]; 87 | [self addSubview:_zanImageView]; 88 | 89 | UITapGestureRecognizer *tapImageViewGesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zanAnimationPlay)]; 90 | [_zanImageView addGestureRecognizer:tapImageViewGesture]; 91 | } 92 | break; 93 | case CatZanButtonTypeFocus:{ 94 | 95 | } 96 | break; 97 | default: 98 | break; 99 | } 100 | } 101 | 102 | /** 103 | * An animation for zan action 104 | */ 105 | -(void)zanAnimationPlay{ 106 | [self setIsZan:!self.isZan]; 107 | if (self.clickHandler!=nil) { 108 | self.clickHandler(self); 109 | } 110 | 111 | switch (_type) { 112 | case CatZanButtonTypeFirework:{ 113 | [_zanImageView setBounds:CGRectMake(0, 0, 0, 0)]; 114 | [UIView animateWithDuration:0.5f delay:0 usingSpringWithDamping:0.3 initialSpringVelocity:5 options:UIViewAnimationOptionCurveLinear animations:^{ 115 | [_zanImageView setBounds:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 116 | if (self.isZan) { 117 | CABasicAnimation *effectLayerAnimation=[CABasicAnimation animationWithKeyPath:@"emitterCells.zanShape.birthRate"]; 118 | [effectLayerAnimation setFromValue:[NSNumber numberWithFloat:100]]; 119 | [effectLayerAnimation setToValue:[NSNumber numberWithFloat:0]]; 120 | [effectLayerAnimation setDuration:0.0f]; 121 | [effectLayerAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; 122 | [_effectLayer addAnimation:effectLayerAnimation forKey:@"ZanCount"]; 123 | } 124 | } completion:^(BOOL finished) { 125 | }]; 126 | // [UIView animateWithDuration:0.2f delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 127 | // [_zanImageView setBounds:CGRectMake(0, 0, CGRectGetWidth(self.frame)*1.5, CGRectGetHeight(self.frame)*1.5)]; 128 | // } completion:^(BOOL finished) { 129 | // [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 130 | // [_zanImageView setBounds:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 131 | // } completion:^(BOOL finished) { 132 | // if (self.isZan) { 133 | // CABasicAnimation *effectLayerAnimation=[CABasicAnimation animationWithKeyPath:@"emitterCells.zanShape.birthRate"]; 134 | // [effectLayerAnimation setFromValue:[NSNumber numberWithFloat:100]]; 135 | // [effectLayerAnimation setToValue:[NSNumber numberWithFloat:0]]; 136 | // [effectLayerAnimation setDuration:0.0f]; 137 | // [effectLayerAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; 138 | // [_effectLayer addAnimation:effectLayerAnimation forKey:@"ZanCount"]; 139 | // } 140 | // }]; 141 | // }]; 142 | } 143 | break; 144 | 145 | default: 146 | break; 147 | } 148 | } 149 | 150 | #pragma mark - Property method 151 | -(void)setIsZan:(BOOL)isZan{ 152 | _isZan=isZan; 153 | if (isZan) { 154 | [_zanImageView setImage:_zanImage]; 155 | }else{ 156 | [_zanImageView setImage:_unZanImage]; 157 | } 158 | } 159 | 160 | /* 161 | // Only override drawRect: if you perform custom drawing. 162 | // An empty implementation adversely affects performance during animation. 163 | - (void)drawRect:(CGRect)rect { 164 | // Drawing code 165 | } 166 | */ 167 | 168 | @end 169 | -------------------------------------------------------------------------------- /CatZanButton/CatZanButton/EffectImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imkcat/CatZanButton/7a71eb36ea3d5121fa61b8b51970abdca1284e86/CatZanButton/CatZanButton/EffectImage.png -------------------------------------------------------------------------------- /CatZanButton/CatZanButton/UnZan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imkcat/CatZanButton/7a71eb36ea3d5121fa61b8b51970abdca1284e86/CatZanButton/CatZanButton/UnZan.png -------------------------------------------------------------------------------- /CatZanButton/CatZanButton/Zan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imkcat/CatZanButton/7a71eb36ea3d5121fa61b8b51970abdca1284e86/CatZanButton/CatZanButton/Zan.png -------------------------------------------------------------------------------- /CatZanButton/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /CatZanButton/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /CatZanButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | co.kcat.$(PRODUCT_NAME:rfc1034identifier) 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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CatZanButton/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class UIGestureRecognizer; 12 | 13 | @interface ViewController : UIViewController 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /CatZanButton/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "CatZanButton.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | CatZanButton *zanBtn=[[CatZanButton alloc] init]; 21 | [zanBtn setCenter:self.view.center]; 22 | [self.view addSubview:zanBtn]; 23 | 24 | [zanBtn setType:CatZanButtonTypeFirework]; 25 | 26 | [zanBtn setClickHandler:^(CatZanButton *zanButton) { 27 | if (zanButton.isZan) { 28 | NSLog(@"Zan!"); 29 | }else{ 30 | NSLog(@"Cancel zan!"); 31 | } 32 | }]; 33 | 34 | // Do any additional setup after loading the view, typically from a nib. 35 | } 36 | 37 | - (void)didReceiveMemoryWarning { 38 | [super didReceiveMemoryWarning]; 39 | // Dispose of any resources that can be recreated. 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CatZanButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CatZanButton 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. 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 | -------------------------------------------------------------------------------- /CatZanButtonTests/CatZanButtonTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CatZanButtonTests.m 3 | // CatZanButtonTests 4 | // 5 | // Created by K-cat on 15/7/13. 6 | // Copyright (c) 2015年 K-cat. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CatZanButtonTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation CatZanButtonTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CatZanButtonTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | co.kcat.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 K-cat 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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CatZanButton 2 | 3 | [![Build Status](https://api.travis-ci.org/K-cat/CatZanButton.svg)](https://travis-ci.org/K-cat) 4 | [![Version](https://img.shields.io/cocoapods/v/CatZanButton.svg)](https://cocoapods.org/pods/CatZanButton) 5 | [![Platform](https://img.shields.io/cocoapods/p/CatZanButton.svg)]() 6 | [![License](https://img.shields.io/cocoapods/l/CatZanButton.svg)]() 7 | 8 | # Introduction 9 | 10 | CatZanButton is easy to create a zan button with cool animation 11 | 12 | # ScreenRecords 13 | 14 | ![ScreenShots1](https://raw.githubusercontent.com/K-cat/CatZanButton/master/ScreenRecord.gif) 15 | 16 | # Installation 17 | 18 | CatZanButton is available on [CocoaPods](http://cocoapods.org).Just add the following to your project Podfile: 19 | 20 | ```ruby 21 | pod 'CatZanButton' 22 | ``` 23 | 24 | #Usage 25 | 26 | ```objective-c 27 | #import "CatZanButton" 28 | 29 | CatZanButton *zanBtn=[[CatZanButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50) zanImage:[UIImage imageNamed:@"Zan"] unZanImage:[UIImage imageNamed:@"UnZan"]]; 30 | [zanBtn setCenter:self.view.center]; 31 | [self.view addSubview:zanBtn]; 32 | 33 | [zanBtn setClickHandler:^(CatZanButton *zanButton) { 34 | if (zanButton.isZan) { 35 | //Do something 36 | }else{ 37 | //Do something 38 | } 39 | }]; 40 | 41 | ``` 42 | -------------------------------------------------------------------------------- /ScreenRecord.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imkcat/CatZanButton/7a71eb36ea3d5121fa61b8b51970abdca1284e86/ScreenRecord.gif --------------------------------------------------------------------------------