├── ActivityIndicatorDemo.xcodeproj └── project.pbxproj ├── ActivityIndicatorDemo ├── ActivityIndicatorDemo-Info.plist ├── ActivityIndicatorDemo-Prefix.pch ├── DemoAppDelegate.h ├── DemoAppDelegate.m ├── DemoViewController.h ├── DemoViewController.m ├── HZActivityIndicatorSubclassExample.h ├── HZActivityIndicatorSubclassExample.m ├── en.lproj │ ├── DemoViewController.xib │ └── InfoPlist.strings └── main.m ├── HZActivityIndicator ├── HZActivityIndicatorView.h └── HZActivityIndicatorView.m ├── HZActivityIndicatorView.podspec ├── LICENSE ├── README.md └── screenshot.png /ActivityIndicatorDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E71A6B7F143FA0C400675778 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E71A6B7E143FA0C400675778 /* DemoViewController.m */; }; 11 | E71A6B82143FA23B00675778 /* HZActivityIndicatorSubclassExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E71A6B81143FA23B00675778 /* HZActivityIndicatorSubclassExample.m */; }; 12 | E71A6B85143FA63400675778 /* HZActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = E71A6B84143FA63400675778 /* HZActivityIndicatorView.m */; }; 13 | E75815AB143F332900EDD1B7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E75815AA143F332900EDD1B7 /* UIKit.framework */; }; 14 | E75815AD143F332900EDD1B7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E75815AC143F332900EDD1B7 /* Foundation.framework */; }; 15 | E75815AF143F332900EDD1B7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E75815AE143F332900EDD1B7 /* CoreGraphics.framework */; }; 16 | E75815B5143F332900EDD1B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E75815B3143F332900EDD1B7 /* InfoPlist.strings */; }; 17 | E75815B7143F332900EDD1B7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E75815B6143F332900EDD1B7 /* main.m */; }; 18 | E75815BB143F332900EDD1B7 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E75815BA143F332900EDD1B7 /* DemoAppDelegate.m */; }; 19 | E75815C1143F332900EDD1B7 /* DemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E75815BF143F332900EDD1B7 /* DemoViewController.xib */; }; 20 | E75815CF143F394400EDD1B7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E75815CE143F394400EDD1B7 /* QuartzCore.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | E71A6B7E143FA0C400675778 /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = DemoViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 25 | E71A6B80143FA23B00675778 /* HZActivityIndicatorSubclassExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = HZActivityIndicatorSubclassExample.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 26 | E71A6B81143FA23B00675778 /* HZActivityIndicatorSubclassExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = HZActivityIndicatorSubclassExample.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 27 | E71A6B83143FA63400675778 /* HZActivityIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = HZActivityIndicatorView.h; path = HZActivityIndicator/HZActivityIndicatorView.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 28 | E71A6B84143FA63400675778 /* HZActivityIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HZActivityIndicatorView.m; path = HZActivityIndicator/HZActivityIndicatorView.m; sourceTree = SOURCE_ROOT; }; 29 | E75815A6143F332900EDD1B7 /* ActivityIndicatorDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ActivityIndicatorDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | E75815AA143F332900EDD1B7 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | E75815AC143F332900EDD1B7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 32 | E75815AE143F332900EDD1B7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 33 | E75815B2143F332900EDD1B7 /* ActivityIndicatorDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ActivityIndicatorDemo-Info.plist"; sourceTree = ""; }; 34 | E75815B4143F332900EDD1B7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 35 | E75815B6143F332900EDD1B7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 36 | E75815B8143F332900EDD1B7 /* ActivityIndicatorDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ActivityIndicatorDemo-Prefix.pch"; sourceTree = ""; }; 37 | E75815B9143F332900EDD1B7 /* DemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DemoAppDelegate.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 38 | E75815BA143F332900EDD1B7 /* DemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = DemoAppDelegate.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 39 | E75815BC143F332900EDD1B7 /* DemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DemoViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 40 | E75815C0143F332900EDD1B7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/DemoViewController.xib; sourceTree = ""; }; 41 | E75815CE143F394400EDD1B7 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | E75815A3143F332900EDD1B7 /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | E75815CF143F394400EDD1B7 /* QuartzCore.framework in Frameworks */, 50 | E75815AB143F332900EDD1B7 /* UIKit.framework in Frameworks */, 51 | E75815AD143F332900EDD1B7 /* Foundation.framework in Frameworks */, 52 | E75815AF143F332900EDD1B7 /* CoreGraphics.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | E758159B143F332900EDD1B7 = { 60 | isa = PBXGroup; 61 | children = ( 62 | E75815B0143F332900EDD1B7 /* ActivityIndicatorDemo */, 63 | E75815A9143F332900EDD1B7 /* Frameworks */, 64 | E75815A7143F332900EDD1B7 /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | E75815A7143F332900EDD1B7 /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | E75815A6143F332900EDD1B7 /* ActivityIndicatorDemo.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | E75815A9143F332900EDD1B7 /* Frameworks */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | E75815CE143F394400EDD1B7 /* QuartzCore.framework */, 80 | E75815AA143F332900EDD1B7 /* UIKit.framework */, 81 | E75815AC143F332900EDD1B7 /* Foundation.framework */, 82 | E75815AE143F332900EDD1B7 /* CoreGraphics.framework */, 83 | ); 84 | name = Frameworks; 85 | sourceTree = ""; 86 | }; 87 | E75815B0143F332900EDD1B7 /* ActivityIndicatorDemo */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | E75815C7143F334700EDD1B7 /* HZActivityIndicatorView */, 91 | E71A6B80143FA23B00675778 /* HZActivityIndicatorSubclassExample.h */, 92 | E71A6B81143FA23B00675778 /* HZActivityIndicatorSubclassExample.m */, 93 | E75815B9143F332900EDD1B7 /* DemoAppDelegate.h */, 94 | E75815BA143F332900EDD1B7 /* DemoAppDelegate.m */, 95 | E75815BC143F332900EDD1B7 /* DemoViewController.h */, 96 | E71A6B7E143FA0C400675778 /* DemoViewController.m */, 97 | E75815BF143F332900EDD1B7 /* DemoViewController.xib */, 98 | E75815B1143F332900EDD1B7 /* Supporting Files */, 99 | ); 100 | path = ActivityIndicatorDemo; 101 | sourceTree = ""; 102 | }; 103 | E75815B1143F332900EDD1B7 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | E75815B2143F332900EDD1B7 /* ActivityIndicatorDemo-Info.plist */, 107 | E75815B3143F332900EDD1B7 /* InfoPlist.strings */, 108 | E75815B6143F332900EDD1B7 /* main.m */, 109 | E75815B8143F332900EDD1B7 /* ActivityIndicatorDemo-Prefix.pch */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | E75815C7143F334700EDD1B7 /* HZActivityIndicatorView */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | E71A6B83143FA63400675778 /* HZActivityIndicatorView.h */, 118 | E71A6B84143FA63400675778 /* HZActivityIndicatorView.m */, 119 | ); 120 | name = HZActivityIndicatorView; 121 | sourceTree = ""; 122 | }; 123 | /* End PBXGroup section */ 124 | 125 | /* Begin PBXNativeTarget section */ 126 | E75815A5143F332900EDD1B7 /* ActivityIndicatorDemo */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = E75815C4143F332900EDD1B7 /* Build configuration list for PBXNativeTarget "ActivityIndicatorDemo" */; 129 | buildPhases = ( 130 | E75815A2143F332900EDD1B7 /* Sources */, 131 | E75815A3143F332900EDD1B7 /* Frameworks */, 132 | E75815A4143F332900EDD1B7 /* Resources */, 133 | ); 134 | buildRules = ( 135 | ); 136 | dependencies = ( 137 | ); 138 | name = ActivityIndicatorDemo; 139 | productName = ActivityIndicatorDemo; 140 | productReference = E75815A6143F332900EDD1B7 /* ActivityIndicatorDemo.app */; 141 | productType = "com.apple.product-type.application"; 142 | }; 143 | /* End PBXNativeTarget section */ 144 | 145 | /* Begin PBXProject section */ 146 | E758159D143F332900EDD1B7 /* Project object */ = { 147 | isa = PBXProject; 148 | attributes = { 149 | LastUpgradeCheck = 0420; 150 | }; 151 | buildConfigurationList = E75815A0143F332900EDD1B7 /* Build configuration list for PBXProject "ActivityIndicatorDemo" */; 152 | compatibilityVersion = "Xcode 3.2"; 153 | developmentRegion = English; 154 | hasScannedForEncodings = 0; 155 | knownRegions = ( 156 | en, 157 | ); 158 | mainGroup = E758159B143F332900EDD1B7; 159 | productRefGroup = E75815A7143F332900EDD1B7 /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | E75815A5143F332900EDD1B7 /* ActivityIndicatorDemo */, 164 | ); 165 | }; 166 | /* End PBXProject section */ 167 | 168 | /* Begin PBXResourcesBuildPhase section */ 169 | E75815A4143F332900EDD1B7 /* Resources */ = { 170 | isa = PBXResourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | E75815B5143F332900EDD1B7 /* InfoPlist.strings in Resources */, 174 | E75815C1143F332900EDD1B7 /* DemoViewController.xib in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXResourcesBuildPhase section */ 179 | 180 | /* Begin PBXSourcesBuildPhase section */ 181 | E75815A2143F332900EDD1B7 /* Sources */ = { 182 | isa = PBXSourcesBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | E75815B7143F332900EDD1B7 /* main.m in Sources */, 186 | E75815BB143F332900EDD1B7 /* DemoAppDelegate.m in Sources */, 187 | E71A6B7F143FA0C400675778 /* DemoViewController.m in Sources */, 188 | E71A6B82143FA23B00675778 /* HZActivityIndicatorSubclassExample.m in Sources */, 189 | E71A6B85143FA63400675778 /* HZActivityIndicatorView.m in Sources */, 190 | ); 191 | runOnlyForDeploymentPostprocessing = 0; 192 | }; 193 | /* End PBXSourcesBuildPhase section */ 194 | 195 | /* Begin PBXVariantGroup section */ 196 | E75815B3143F332900EDD1B7 /* InfoPlist.strings */ = { 197 | isa = PBXVariantGroup; 198 | children = ( 199 | E75815B4143F332900EDD1B7 /* en */, 200 | ); 201 | name = InfoPlist.strings; 202 | sourceTree = ""; 203 | }; 204 | E75815BF143F332900EDD1B7 /* DemoViewController.xib */ = { 205 | isa = PBXVariantGroup; 206 | children = ( 207 | E75815C0143F332900EDD1B7 /* en */, 208 | ); 209 | name = DemoViewController.xib; 210 | sourceTree = ""; 211 | }; 212 | /* End PBXVariantGroup section */ 213 | 214 | /* Begin XCBuildConfiguration section */ 215 | E75815C2143F332900EDD1B7 /* Debug */ = { 216 | isa = XCBuildConfiguration; 217 | buildSettings = { 218 | ALWAYS_SEARCH_USER_PATHS = NO; 219 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 220 | CLANG_ENABLE_OBJC_ARC = YES; 221 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 222 | COPY_PHASE_STRIP = NO; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 231 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 232 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 233 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 234 | GCC_WARN_UNUSED_VARIABLE = YES; 235 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 236 | SDKROOT = iphoneos; 237 | }; 238 | name = Debug; 239 | }; 240 | E75815C3143F332900EDD1B7 /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 247 | COPY_PHASE_STRIP = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu99; 249 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 250 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 254 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 255 | SDKROOT = iphoneos; 256 | VALIDATE_PRODUCT = YES; 257 | }; 258 | name = Release; 259 | }; 260 | E75815C5143F332900EDD1B7 /* Debug */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 264 | GCC_PREFIX_HEADER = "ActivityIndicatorDemo/ActivityIndicatorDemo-Prefix.pch"; 265 | INFOPLIST_FILE = "ActivityIndicatorDemo/ActivityIndicatorDemo-Info.plist"; 266 | PRODUCT_NAME = "$(TARGET_NAME)"; 267 | WRAPPER_EXTENSION = app; 268 | }; 269 | name = Debug; 270 | }; 271 | E75815C6143F332900EDD1B7 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 275 | GCC_PREFIX_HEADER = "ActivityIndicatorDemo/ActivityIndicatorDemo-Prefix.pch"; 276 | INFOPLIST_FILE = "ActivityIndicatorDemo/ActivityIndicatorDemo-Info.plist"; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | WRAPPER_EXTENSION = app; 279 | }; 280 | name = Release; 281 | }; 282 | /* End XCBuildConfiguration section */ 283 | 284 | /* Begin XCConfigurationList section */ 285 | E75815A0143F332900EDD1B7 /* Build configuration list for PBXProject "ActivityIndicatorDemo" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | E75815C2143F332900EDD1B7 /* Debug */, 289 | E75815C3143F332900EDD1B7 /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | E75815C4143F332900EDD1B7 /* Build configuration list for PBXNativeTarget "ActivityIndicatorDemo" */ = { 295 | isa = XCConfigurationList; 296 | buildConfigurations = ( 297 | E75815C5143F332900EDD1B7 /* Debug */, 298 | E75815C6143F332900EDD1B7 /* Release */, 299 | ); 300 | defaultConfigurationIsVisible = 0; 301 | defaultConfigurationName = Release; 302 | }; 303 | /* End XCConfigurationList section */ 304 | }; 305 | rootObject = E758159D143F332900EDD1B7 /* Project object */; 306 | } 307 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/ActivityIndicatorDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.hezicohen.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/ActivityIndicatorDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ActivityIndicatorDemo' target in the 'ActivityIndicatorDemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/DemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoAppDelegate.h 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import 37 | 38 | @class DemoViewController; 39 | 40 | @interface DemoAppDelegate : UIResponder 41 | 42 | @property (strong, nonatomic) UIWindow *window; 43 | 44 | @property (strong, nonatomic) DemoViewController *viewController; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/DemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoAppDelegate.m 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import "DemoAppDelegate.h" 37 | #import "DemoViewController.h" 38 | 39 | @implementation DemoAppDelegate 40 | 41 | @synthesize window = _window; 42 | @synthesize viewController = _viewController; 43 | 44 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 45 | { 46 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 47 | // Override point for customization after application launch. 48 | self.viewController = [[DemoViewController alloc] initWithNibName:@"DemoViewController" bundle:nil]; 49 | self.window.rootViewController = self.viewController; 50 | [self.window makeKeyAndVisible]; 51 | return YES; 52 | } 53 | 54 | - (void)applicationWillResignActive:(UIApplication *)application 55 | { 56 | /* 57 | 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. 58 | 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. 59 | */ 60 | } 61 | 62 | - (void)applicationDidEnterBackground:(UIApplication *)application 63 | { 64 | /* 65 | 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. 66 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 67 | */ 68 | } 69 | 70 | - (void)applicationWillEnterForeground:(UIApplication *)application 71 | { 72 | /* 73 | 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. 74 | */ 75 | } 76 | 77 | - (void)applicationDidBecomeActive:(UIApplication *)application 78 | { 79 | /* 80 | 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. 81 | */ 82 | } 83 | 84 | - (void)applicationWillTerminate:(UIApplication *)application 85 | { 86 | /* 87 | Called when the application is about to terminate. 88 | Save data if appropriate. 89 | See also applicationDidEnterBackground:. 90 | */ 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/DemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.h 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import 37 | #import "HZActivityIndicatorView.h" 38 | 39 | @interface DemoViewController : UIViewController 40 | @property (unsafe_unretained, nonatomic) IBOutlet HZActivityIndicatorView *customIndicator; 41 | @property (unsafe_unretained, nonatomic) IBOutlet UIActivityIndicatorView *nativeIndicator; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/DemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.m 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import "DemoViewController.h" 37 | 38 | #import "HZActivityIndicatorView.h" 39 | #import "HZActivityIndicatorSubclassExample.h" 40 | 41 | @implementation DemoViewController 42 | @synthesize customIndicator; 43 | @synthesize nativeIndicator; 44 | 45 | - (void)didReceiveMemoryWarning 46 | { 47 | [super didReceiveMemoryWarning]; 48 | // Release any cached data, images, etc that aren't in use. 49 | } 50 | 51 | #pragma mark - View lifecycle 52 | 53 | - (void)viewDidLoad 54 | { 55 | [super viewDidLoad]; 56 | 57 | HZActivityIndicatorView *activityIndicator = [[HZActivityIndicatorView alloc] initWithFrame:CGRectMake(50, 50, 0, 0)]; 58 | activityIndicator.backgroundColor = self.view.backgroundColor; 59 | activityIndicator.opaque = YES; 60 | activityIndicator.steps = 8; 61 | activityIndicator.finSize = CGSizeMake(17, 10); 62 | activityIndicator.indicatorRadius = 20; 63 | activityIndicator.stepDuration = 0.150; 64 | activityIndicator.color = [UIColor colorWithRed:85.0/255.0 green:0.0 blue:0.0 alpha:1.000]; 65 | activityIndicator.cornerRadii = CGSizeMake(0, 0); 66 | [activityIndicator startAnimating]; 67 | [self.view addSubview:activityIndicator]; 68 | 69 | activityIndicator = [[HZActivityIndicatorSubclassExample alloc] initWithFrame:CGRectMake(150, 50, 0, 0)]; 70 | activityIndicator.backgroundColor = self.view.backgroundColor; 71 | activityIndicator.opaque = YES; 72 | activityIndicator.steps = 8; 73 | activityIndicator.finSize = CGSizeMake(20, 10); 74 | activityIndicator.indicatorRadius = 10; 75 | activityIndicator.stepDuration = 0.0570; 76 | activityIndicator.roundedCoreners = UIRectCornerAllCorners; 77 | activityIndicator.cornerRadii = CGSizeMake(4, 4); 78 | activityIndicator.color = [UIColor darkGrayColor]; 79 | activityIndicator.direction = HZActivityIndicatorDirectionCounterClockwise; 80 | [activityIndicator startAnimating]; 81 | [self.view addSubview:activityIndicator]; 82 | 83 | activityIndicator = [[HZActivityIndicatorView alloc] initWithFrame:CGRectMake(50, 150, 0, 0)]; 84 | activityIndicator.backgroundColor = self.view.backgroundColor; 85 | activityIndicator.opaque = YES; 86 | activityIndicator.steps = 16; 87 | activityIndicator.finSize = CGSizeMake(8, 40); 88 | activityIndicator.indicatorRadius = 20; 89 | activityIndicator.stepDuration = 0.100; 90 | activityIndicator.color = [UIColor colorWithRed:0.0 green:34.0/255.0 blue:85.0/255.0 alpha:1.000]; 91 | activityIndicator.roundedCoreners = UIRectCornerTopRight; 92 | activityIndicator.cornerRadii = CGSizeMake(10, 10); 93 | [activityIndicator startAnimating]; 94 | [self.view addSubview:activityIndicator]; 95 | 96 | [customIndicator startAnimating]; 97 | [nativeIndicator startAnimating]; 98 | } 99 | 100 | - (void)viewDidUnload 101 | { 102 | [self setCustomIndicator:nil]; 103 | [self setNativeIndicator:nil]; 104 | [super viewDidUnload]; 105 | // Release any retained subviews of the main view. 106 | // e.g. self.myOutlet = nil; 107 | } 108 | 109 | - (void)viewWillAppear:(BOOL)animated 110 | { 111 | [super viewWillAppear:animated]; 112 | } 113 | 114 | - (void)viewDidAppear:(BOOL)animated 115 | { 116 | [super viewDidAppear:animated]; 117 | } 118 | 119 | - (void)viewWillDisappear:(BOOL)animated 120 | { 121 | [super viewWillDisappear:animated]; 122 | } 123 | 124 | - (void)viewDidDisappear:(BOOL)animated 125 | { 126 | [super viewDidDisappear:animated]; 127 | } 128 | 129 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 130 | { 131 | // Return YES for supported orientations 132 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/HZActivityIndicatorSubclassExample.h: -------------------------------------------------------------------------------- 1 | // 2 | // HZActivityIndicatorSubclassExample.h 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import "HZActivityIndicatorView.h" 37 | 38 | @interface HZActivityIndicatorSubclassExample : HZActivityIndicatorView 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/HZActivityIndicatorSubclassExample.m: -------------------------------------------------------------------------------- 1 | // 2 | // HZActivityIndicatorSubclassExample.m 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import "HZActivityIndicatorSubclassExample.h" 37 | 38 | @implementation HZActivityIndicatorSubclassExample 39 | 40 | - (UIBezierPath *)finPathWithRect:(CGRect)rect 41 | { 42 | UIBezierPath *bezierPath = [UIBezierPath bezierPath]; 43 | [bezierPath moveToPoint:rect.origin]; 44 | [bezierPath addCurveToPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)) 45 | controlPoint1:CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)/4) 46 | controlPoint2:CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect))]; 47 | 48 | return bezierPath; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/en.lproj/DemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11A511 6 | 1938 7 | 1138 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 933 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUIActivityIndicatorView 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 292 41 | {{20, 331}, {20, 20}} 42 | 43 | 44 | _NS:196 45 | 46 | 3 47 | MQA 48 | 49 | 2 50 | 51 | 52 | IBCocoaTouchFramework 53 | 54 | 55 | 56 | 292 57 | {{66, 322}, {37, 37}} 58 | 59 | _NS:1030 60 | NO 61 | IBCocoaTouchFramework 62 | NO 63 | 0 64 | 65 | 66 | {{0, 20}, {320, 460}} 67 | 68 | 69 | 3 70 | MC43NQA 71 | 72 | 73 | NO 74 | 75 | IBCocoaTouchFramework 76 | 77 | 78 | 79 | 80 | 81 | 82 | view 83 | 84 | 85 | 86 | 7 87 | 88 | 89 | 90 | customIndicator 91 | 92 | 93 | 94 | 14 95 | 96 | 97 | 98 | nativeIndicator 99 | 100 | 101 | 102 | 15 103 | 104 | 105 | 106 | 107 | 108 | 0 109 | 110 | 111 | 112 | 113 | 114 | -1 115 | 116 | 117 | File's Owner 118 | 119 | 120 | -2 121 | 122 | 123 | 124 | 125 | 6 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 9 135 | 136 | 137 | 138 | 139 | 13 140 | 141 | 142 | 143 | 144 | 145 | 146 | DemoViewController 147 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 148 | UIResponder 149 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 150 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 151 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 152 | HZActivityIndicatorView 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | 155 | 156 | 157 | 158 | 159 | 15 160 | 161 | 162 | 0 163 | IBCocoaTouchFramework 164 | YES 165 | 3 166 | 933 167 | 168 | 169 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ActivityIndicatorDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ActivityIndicatorDemo 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DemoAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([DemoAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HZActivityIndicator/HZActivityIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HZActivityIndicator.h 3 | // HZActivityIndicator 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import 37 | 38 | typedef enum HZActivityIndicatorDirection 39 | { 40 | HZActivityIndicatorDirectionClockwise = -1, 41 | HZActivityIndicatorDirectionCounterClockwise = 1 42 | } HZActivityIndicatorDirection; 43 | 44 | @interface HZActivityIndicatorView : UIView 45 | { 46 | NSUInteger _steps; 47 | CGFloat _stepDuration; 48 | BOOL _isAnimating; 49 | 50 | UIColor *_color; 51 | BOOL _hidesWhenStopped; 52 | UIRectCorner _roundedCoreners; 53 | CGSize _cornerRadii; 54 | CGSize _finSize; 55 | HZActivityIndicatorDirection _direction; 56 | UIActivityIndicatorViewStyle _actualActivityIndicatorViewStyle; 57 | } 58 | 59 | @property (nonatomic) NSUInteger steps; 60 | @property (nonatomic) NSUInteger indicatorRadius; 61 | @property (nonatomic) CGFloat stepDuration; 62 | @property (nonatomic) CGSize finSize; 63 | @property (nonatomic, strong) UIColor *color; 64 | @property (nonatomic) UIRectCorner roundedCoreners; 65 | @property (nonatomic) CGSize cornerRadii; 66 | @property (nonatomic) HZActivityIndicatorDirection direction; 67 | @property (nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; 68 | @property (nonatomic) CGFloat progress; 69 | 70 | @property(nonatomic) BOOL hidesWhenStopped; 71 | 72 | - (id)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style; 73 | 74 | - (void)startAnimating; 75 | - (void)stopAnimating; 76 | - (BOOL)isAnimating; 77 | 78 | - (UIBezierPath *)finPathWithRect:(CGRect)rect; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /HZActivityIndicator/HZActivityIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HZActivityIndicator.m 3 | // HZActivityIndicator 4 | // 5 | // Created by Hezi Cohen on 10/7/11. 6 | // Copyright (c) 2011 Hezi Cohen. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 19 | // Neither the name of the project's author nor the names of its 20 | // contributors may be used to endorse or promote products derived from 21 | // this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #import "HZActivityIndicatorView.h" 37 | 38 | @interface HZActivityIndicatorView () 39 | { 40 | NSTimer *_timer; 41 | CGFloat _anglePerStep; 42 | CGFloat _currStep; 43 | } 44 | 45 | - (void)_repeatAnimation:(NSTimer*)timer; 46 | - (UIColor*)_colorForStep:(NSUInteger)stepIndex; 47 | - (void)_setPropertiesForStyle:(UIActivityIndicatorViewStyle)style; 48 | 49 | @end 50 | 51 | @implementation HZActivityIndicatorView 52 | @synthesize steps = _steps; 53 | @synthesize indicatorRadius = _indicatorRadius; 54 | @synthesize finSize = _finSize; 55 | @synthesize color = _color; 56 | @synthesize stepDuration = _stepDuration; 57 | @synthesize hidesWhenStopped = _hidesWhenStopped; 58 | @synthesize roundedCoreners = _roundedCoreners; 59 | @synthesize cornerRadii = _cornerRadii; 60 | @synthesize direction = _direction; 61 | @synthesize activityIndicatorViewStyle = _actualActivityIndicatorViewStyle; 62 | 63 | - (void)awakeFromNib 64 | { 65 | [self _setPropertiesForStyle:UIActivityIndicatorViewStyleWhite]; 66 | } 67 | 68 | - (id)initWithFrame:(CGRect)frame 69 | { 70 | self = [super initWithFrame:frame]; 71 | if (self) 72 | { 73 | [self _setPropertiesForStyle:UIActivityIndicatorViewStyleWhite]; 74 | } 75 | return self; 76 | } 77 | 78 | - (id)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style; 79 | { 80 | self = [self initWithFrame:CGRectZero]; 81 | if (self) 82 | { 83 | [self _setPropertiesForStyle:style]; 84 | } 85 | return self; 86 | } 87 | 88 | - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle 89 | { 90 | [self _setPropertiesForStyle:activityIndicatorViewStyle]; 91 | } 92 | 93 | - (void)_setPropertiesForStyle:(UIActivityIndicatorViewStyle)style 94 | { 95 | self.backgroundColor = [UIColor clearColor]; 96 | self.direction = HZActivityIndicatorDirectionClockwise; 97 | self.roundedCoreners = UIRectCornerAllCorners; 98 | self.cornerRadii = CGSizeMake(1, 1); 99 | self.stepDuration = 0.1; 100 | self.steps = 12; 101 | 102 | switch (style) { 103 | case UIActivityIndicatorViewStyleGray: 104 | { 105 | self.color = [UIColor darkGrayColor]; 106 | self.finSize = CGSizeMake(2, 5); 107 | self.indicatorRadius = 5; 108 | 109 | break; 110 | } 111 | 112 | case UIActivityIndicatorViewStyleWhite: 113 | { 114 | self.color = [UIColor whiteColor]; 115 | self.finSize = CGSizeMake(2, 5); 116 | self.indicatorRadius = 5; 117 | 118 | break; 119 | } 120 | 121 | case UIActivityIndicatorViewStyleWhiteLarge: 122 | { 123 | self.color = [UIColor whiteColor]; 124 | self.cornerRadii = CGSizeMake(2, 2); 125 | self.finSize = CGSizeMake(3, 9); 126 | self.indicatorRadius = 8.5; 127 | 128 | break; 129 | } 130 | 131 | default: 132 | [NSException raise:NSInvalidArgumentException format:@"style invalid"]; 133 | break; 134 | } 135 | 136 | _isAnimating = NO; 137 | if (_hidesWhenStopped) 138 | self.hidden = YES; 139 | } 140 | 141 | #pragma mark - UIActivityIndicator 142 | 143 | - (void)startAnimating 144 | { 145 | if(self.isAnimating) 146 | return; 147 | 148 | // maa bugfix: this was 0 in the original code. this means clockwise rotation starts more slowly than it should. 149 | _currStep = self.direction == HZActivityIndicatorDirectionClockwise ? self.steps - 1 : 0; 150 | _timer = [NSTimer scheduledTimerWithTimeInterval:_stepDuration target:self selector:@selector(_repeatAnimation:) userInfo:nil repeats:YES]; 151 | _isAnimating = YES; 152 | 153 | if (_hidesWhenStopped) 154 | self.hidden = NO; 155 | } 156 | 157 | - (void)stopAnimating 158 | { 159 | if (_timer) 160 | { 161 | [_timer invalidate]; 162 | _timer = nil; 163 | } 164 | 165 | _isAnimating = NO; 166 | if (_hidesWhenStopped) 167 | self.hidden = YES; 168 | } 169 | 170 | - (BOOL)isAnimating 171 | { 172 | return _isAnimating; 173 | } 174 | 175 | #pragma mark - HZActivityIndicator Drawing. 176 | 177 | - (void)setIndicatorRadius:(NSUInteger)indicatorRadius 178 | { 179 | _indicatorRadius = indicatorRadius; 180 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, 181 | _indicatorRadius*2 + _finSize.height*2, 182 | _indicatorRadius*2 + _finSize.height*2); 183 | [self setNeedsDisplay]; 184 | } 185 | 186 | - (void)setSteps:(NSUInteger)steps 187 | { 188 | _anglePerStep = (360.0 / (CGFloat)steps) * M_PI / 180.0; 189 | _steps = steps; 190 | [self setNeedsDisplay]; 191 | } 192 | 193 | - (void)setFinSize:(CGSize)finSize 194 | { 195 | _finSize = finSize; 196 | [self setNeedsDisplay]; 197 | } 198 | 199 | - (void)setProgress:(CGFloat)progress 200 | { 201 | _progress = progress; 202 | [self setNeedsDisplay]; 203 | } 204 | - (UIColor*)_colorForStep:(NSUInteger)stepIndex 205 | { 206 | CGFloat alpha = 1.0 - (stepIndex % _steps) * (1.0 / _steps); 207 | CGColorRef copiedColor = CGColorCreateCopyWithAlpha(_color.CGColor, alpha); 208 | UIColor *color = [UIColor colorWithCGColor:copiedColor]; 209 | CGColorRelease(copiedColor); 210 | return color; 211 | } 212 | 213 | - (void)_repeatAnimation:(NSTimer*)timer 214 | { 215 | _currStep++; 216 | [self setNeedsDisplay]; 217 | } 218 | 219 | - (UIBezierPath *)finPathWithRect:(CGRect)rect 220 | { 221 | return [UIBezierPath bezierPathWithRoundedRect:rect 222 | byRoundingCorners:_roundedCoreners 223 | cornerRadii:_cornerRadii]; 224 | } 225 | 226 | - (void)drawRect:(CGRect)rect 227 | { 228 | CGContextRef context = UIGraphicsGetCurrentContext(); 229 | 230 | CGRect finRect = CGRectMake(self.bounds.size.width/2 - _finSize.width/2, 0, 231 | _finSize.width, _finSize.height); 232 | UIBezierPath *bezierPath = [self finPathWithRect:finRect]; 233 | 234 | CGPathRef bezierPathRef = CGPathCreateCopy([bezierPath CGPath]); 235 | 236 | for (int i = 0; i < _steps; i++) 237 | { 238 | if (!_isAnimating && _progress < ((CGFloat)(i + 1) / (CGFloat)(_steps))) break; 239 | [[self _colorForStep:_currStep+i*_direction] set]; 240 | 241 | CGContextBeginPath(context); 242 | CGContextAddPath(context, bezierPathRef); 243 | CGContextClosePath(context); 244 | CGContextFillPath(context); 245 | 246 | CGContextTranslateCTM(context, self.bounds.size.width / 2, self.bounds.size.height / 2); 247 | CGContextRotateCTM(context, _anglePerStep); 248 | CGContextTranslateCTM(context, -(self.bounds.size.width / 2), -(self.bounds.size.height / 2)); 249 | } 250 | 251 | CGPathRelease(bezierPathRef); 252 | } 253 | 254 | 255 | @end 256 | -------------------------------------------------------------------------------- /HZActivityIndicatorView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "HZActivityIndicatorView" 4 | s.version = "0.0.1" 5 | s.summary = "Customizable activity indicator." 6 | 7 | s.description = <<-DESC 8 | A highly customizable drop-in replacement for UIActivityIndicatorView 9 | DESC 10 | 11 | s.homepage = "https://github.com/hezi/HZActivityIndicatorView" 12 | 13 | s.license = 'BSD-new' 14 | 15 | s.requires_arc = true 16 | 17 | s.author = { "Hezi Cohen" => "" } 18 | 19 | s.platform = :ios 20 | 21 | s.source = { :git => "https://github.com/hezi/HZActivityIndicatorView.git", :commit => "d4de1762c374eb435a18978dba29f3554fe0406d" } 22 | 23 | s.source_files = 'HZActivityIndicator/*.{h,m}' 24 | s.exclude_files = 'ActivityIndicatorDemo/**', 'ActivityIndicatorDemo.xcodeproj/**' 25 | 26 | end 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Created by Hezi Cohen on 10/7/11. 2 | Copyright (c) 2011 Hezi Cohen. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | Neither the name of the project's author nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HZActivityIndicatorView 2 | A highly customizable drop-in replacement for UIActivityIndicatorView 3 | 4 | ![HZActivityIndicatorView Screenshot](https://github.com/hezi/HZActivityIndicatorView/raw/master/screenshot.png) 5 | 6 | HZActivityIndicatorView has to be compiled with ARC, a branch with classic memory managment might be added soon. 7 | 8 | ## Usage 9 | 10 | HZActivityIndicatorView can be used just like UIActivityIndicatorView and supports the default UIKit styles for activity indicators. 11 | 12 | HZActivityIndicatorView *activityIndicator = [[HZActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; 13 | [activityIndicator startAnimating]; 14 | 15 | ## Customization 16 | 17 | A few extra properties allow you to further customize the activity indicator 18 | 19 | // size is automatically calculated using finSize and indicatorRadius, 20 | // so no need to set it. 21 | HZActivityIndicatorView *activityIndicator = 22 | [[HZActivityIndicatorView alloc] initWithFrame:CGRectMake(50, 50, 0, 0)]; 23 | 24 | // set the number of "fins" in our indicator 25 | activityIndicator.steps = 8; 26 | 27 | // size of each fin 28 | activityIndicator.finSize = CGSizeMake(17, 10); 29 | 30 | // which corners are round 31 | activityIndicator.roundedCoreners = UIRectCornerAllCorners; 32 | 33 | // corner radius of fins 34 | activityIndicator.cornerRadii = CGSizeMake(0, 0); 35 | 36 | // radius of the inner circle 37 | activityIndicator.indicatorRadius = 20; 38 | 39 | // animation interval 40 | activityIndicator.stepDuration = 0.1; 41 | 42 | // indicator color 43 | activityIndicator.color = [UIColor colorWithRed:85.0/255.0 green:0.0 blue:0.0 alpha:1.000]; 44 | 45 | // animation direction 46 | activityIndicator.direction = HZActivityIndicatorDirectionCounterClockwise; 47 | 48 | [activityIndicator startAnimating]; 49 | 50 | ## Known Issues 51 | 52 | * default styles are still a bit off. 53 | 54 | 55 | ### Copyright 56 | Copyright 2011 Hezi Cohen. All rights reserved. See LICENSE for more details. -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezi/HZActivityIndicatorView/17076859d738981f609199de6cf0fe81b5582d8d/screenshot.png --------------------------------------------------------------------------------