├── CircularProgressControl.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── CircularProgressControl ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ ├── Localizable.strings │ └── Main.storyboard ├── CircularProgressView │ ├── CircleProgressView.h │ ├── CircleProgressView.m │ ├── CircleShapeLayer.h │ └── CircleShapeLayer.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ProgressViewController.h ├── ProgressViewController.m ├── Session.h ├── Session.m ├── ViewController.h ├── ViewController.m ├── main.m └── pt.lproj │ ├── LaunchScreen.strings │ └── Localizable.strings ├── CircularProgressControlTests ├── CircularProgressControlTests.m └── Info.plist ├── LICENSE └── README.md /CircularProgressControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 873C0F421A20D35F006BE395 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F411A20D35F006BE395 /* main.m */; }; 11 | 873C0F451A20D360006BE395 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F441A20D360006BE395 /* AppDelegate.m */; }; 12 | 873C0F4B1A20D360006BE395 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873C0F491A20D360006BE395 /* Main.storyboard */; }; 13 | 873C0F4D1A20D360006BE395 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 873C0F4C1A20D360006BE395 /* Images.xcassets */; }; 14 | 873C0F501A20D360006BE395 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 873C0F4E1A20D360006BE395 /* LaunchScreen.xib */; }; 15 | 873C0F5C1A20D360006BE395 /* CircularProgressControlTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F5B1A20D360006BE395 /* CircularProgressControlTests.m */; }; 16 | 873C0F6D1A20D593006BE395 /* CircleShapeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F6C1A20D593006BE395 /* CircleShapeLayer.m */; }; 17 | 873C0F701A20D685006BE395 /* CircleProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F6F1A20D685006BE395 /* CircleProgressView.m */; }; 18 | 873C0F731A20DE4A006BE395 /* ProgressViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F721A20DE4A006BE395 /* ProgressViewController.m */; }; 19 | 873C0F761A2159DB006BE395 /* Session.m in Sources */ = {isa = PBXBuildFile; fileRef = 873C0F751A2159DB006BE395 /* Session.m */; }; 20 | 873C0F7A1A216BE9006BE395 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 873C0F7C1A216BE9006BE395 /* Localizable.strings */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 873C0F561A20D360006BE395 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 873C0F341A20D35F006BE395 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 873C0F3B1A20D35F006BE395; 29 | remoteInfo = CircularProgressControl; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 873C0F3C1A20D35F006BE395 /* CircularProgressControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CircularProgressControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 873C0F401A20D35F006BE395 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 873C0F411A20D35F006BE395 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 873C0F431A20D35F006BE395 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 873C0F441A20D360006BE395 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 873C0F4A1A20D360006BE395 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 873C0F4C1A20D360006BE395 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 873C0F4F1A20D360006BE395 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 873C0F551A20D360006BE395 /* CircularProgressControlTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CircularProgressControlTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 873C0F5A1A20D360006BE395 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 873C0F5B1A20D360006BE395 /* CircularProgressControlTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CircularProgressControlTests.m; sourceTree = ""; }; 45 | 873C0F6B1A20D593006BE395 /* CircleShapeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CircleShapeLayer.h; path = CircularProgressView/CircleShapeLayer.h; sourceTree = ""; }; 46 | 873C0F6C1A20D593006BE395 /* CircleShapeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CircleShapeLayer.m; path = CircularProgressView/CircleShapeLayer.m; sourceTree = ""; }; 47 | 873C0F6E1A20D685006BE395 /* CircleProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CircleProgressView.h; path = CircularProgressView/CircleProgressView.h; sourceTree = ""; }; 48 | 873C0F6F1A20D685006BE395 /* CircleProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CircleProgressView.m; path = CircularProgressView/CircleProgressView.m; sourceTree = ""; }; 49 | 873C0F711A20DE4A006BE395 /* ProgressViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressViewController.h; sourceTree = ""; }; 50 | 873C0F721A20DE4A006BE395 /* ProgressViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProgressViewController.m; sourceTree = ""; }; 51 | 873C0F741A2159DB006BE395 /* Session.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Session.h; sourceTree = ""; }; 52 | 873C0F751A2159DB006BE395 /* Session.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Session.m; sourceTree = ""; }; 53 | 873C0F7B1A216BE9006BE395 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; }; 54 | 873C0F7D1A2170A9006BE395 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/LaunchScreen.strings; sourceTree = ""; }; 55 | 873C0F7E1A2170AA006BE395 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 873C0F391A20D35F006BE395 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 873C0F521A20D360006BE395 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 873C0F331A20D35F006BE395 = { 77 | isa = PBXGroup; 78 | children = ( 79 | 873C0F3E1A20D35F006BE395 /* CircularProgressControl */, 80 | 873C0F581A20D360006BE395 /* CircularProgressControlTests */, 81 | 873C0F3D1A20D35F006BE395 /* Products */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 873C0F3D1A20D35F006BE395 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 873C0F3C1A20D35F006BE395 /* CircularProgressControl.app */, 89 | 873C0F551A20D360006BE395 /* CircularProgressControlTests.xctest */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 873C0F3E1A20D35F006BE395 /* CircularProgressControl */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 873C0F661A20D415006BE395 /* Model */, 98 | 873C0F651A20D40E006BE395 /* View */, 99 | 873C0F671A20D41C006BE395 /* Controller */, 100 | 873C0F6A1A20D4B9006BE395 /* Resources */, 101 | 873C0F3F1A20D35F006BE395 /* Supporting Files */, 102 | ); 103 | path = CircularProgressControl; 104 | sourceTree = ""; 105 | }; 106 | 873C0F3F1A20D35F006BE395 /* Supporting Files */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 873C0F491A20D360006BE395 /* Main.storyboard */, 110 | 873C0F4E1A20D360006BE395 /* LaunchScreen.xib */, 111 | 873C0F401A20D35F006BE395 /* Info.plist */, 112 | 873C0F411A20D35F006BE395 /* main.m */, 113 | 873C0F7C1A216BE9006BE395 /* Localizable.strings */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | 873C0F581A20D360006BE395 /* CircularProgressControlTests */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 873C0F5B1A20D360006BE395 /* CircularProgressControlTests.m */, 122 | 873C0F591A20D360006BE395 /* Supporting Files */, 123 | ); 124 | path = CircularProgressControlTests; 125 | sourceTree = ""; 126 | }; 127 | 873C0F591A20D360006BE395 /* Supporting Files */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 873C0F5A1A20D360006BE395 /* Info.plist */, 131 | ); 132 | name = "Supporting Files"; 133 | sourceTree = ""; 134 | }; 135 | 873C0F651A20D40E006BE395 /* View */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 873C0F681A20D452006BE395 /* CircularProgressView */, 139 | ); 140 | name = View; 141 | sourceTree = ""; 142 | }; 143 | 873C0F661A20D415006BE395 /* Model */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 873C0F741A2159DB006BE395 /* Session.h */, 147 | 873C0F751A2159DB006BE395 /* Session.m */, 148 | ); 149 | name = Model; 150 | sourceTree = ""; 151 | }; 152 | 873C0F671A20D41C006BE395 /* Controller */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 873C0F691A20D495006BE395 /* AppDelegate */, 156 | 873C0F771A216538006BE395 /* ProgressViewController */, 157 | ); 158 | name = Controller; 159 | sourceTree = ""; 160 | }; 161 | 873C0F681A20D452006BE395 /* CircularProgressView */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 873C0F6B1A20D593006BE395 /* CircleShapeLayer.h */, 165 | 873C0F6C1A20D593006BE395 /* CircleShapeLayer.m */, 166 | 873C0F6E1A20D685006BE395 /* CircleProgressView.h */, 167 | 873C0F6F1A20D685006BE395 /* CircleProgressView.m */, 168 | ); 169 | name = CircularProgressView; 170 | sourceTree = ""; 171 | }; 172 | 873C0F691A20D495006BE395 /* AppDelegate */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | 873C0F431A20D35F006BE395 /* AppDelegate.h */, 176 | 873C0F441A20D360006BE395 /* AppDelegate.m */, 177 | ); 178 | name = AppDelegate; 179 | sourceTree = ""; 180 | }; 181 | 873C0F6A1A20D4B9006BE395 /* Resources */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 873C0F4C1A20D360006BE395 /* Images.xcassets */, 185 | ); 186 | name = Resources; 187 | sourceTree = ""; 188 | }; 189 | 873C0F771A216538006BE395 /* ProgressViewController */ = { 190 | isa = PBXGroup; 191 | children = ( 192 | 873C0F711A20DE4A006BE395 /* ProgressViewController.h */, 193 | 873C0F721A20DE4A006BE395 /* ProgressViewController.m */, 194 | ); 195 | name = ProgressViewController; 196 | sourceTree = ""; 197 | }; 198 | /* End PBXGroup section */ 199 | 200 | /* Begin PBXNativeTarget section */ 201 | 873C0F3B1A20D35F006BE395 /* CircularProgressControl */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = 873C0F5F1A20D360006BE395 /* Build configuration list for PBXNativeTarget "CircularProgressControl" */; 204 | buildPhases = ( 205 | 873C0F381A20D35F006BE395 /* Sources */, 206 | 873C0F391A20D35F006BE395 /* Frameworks */, 207 | 873C0F3A1A20D35F006BE395 /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | ); 213 | name = CircularProgressControl; 214 | productName = CircularProgressControl; 215 | productReference = 873C0F3C1A20D35F006BE395 /* CircularProgressControl.app */; 216 | productType = "com.apple.product-type.application"; 217 | }; 218 | 873C0F541A20D360006BE395 /* CircularProgressControlTests */ = { 219 | isa = PBXNativeTarget; 220 | buildConfigurationList = 873C0F621A20D360006BE395 /* Build configuration list for PBXNativeTarget "CircularProgressControlTests" */; 221 | buildPhases = ( 222 | 873C0F511A20D360006BE395 /* Sources */, 223 | 873C0F521A20D360006BE395 /* Frameworks */, 224 | 873C0F531A20D360006BE395 /* Resources */, 225 | ); 226 | buildRules = ( 227 | ); 228 | dependencies = ( 229 | 873C0F571A20D360006BE395 /* PBXTargetDependency */, 230 | ); 231 | name = CircularProgressControlTests; 232 | productName = CircularProgressControlTests; 233 | productReference = 873C0F551A20D360006BE395 /* CircularProgressControlTests.xctest */; 234 | productType = "com.apple.product-type.bundle.unit-test"; 235 | }; 236 | /* End PBXNativeTarget section */ 237 | 238 | /* Begin PBXProject section */ 239 | 873C0F341A20D35F006BE395 /* Project object */ = { 240 | isa = PBXProject; 241 | attributes = { 242 | LastUpgradeCheck = 0610; 243 | ORGANIZATIONNAME = Mobistart; 244 | TargetAttributes = { 245 | 873C0F3B1A20D35F006BE395 = { 246 | CreatedOnToolsVersion = 6.1; 247 | DevelopmentTeam = JAH63CX6ST; 248 | }; 249 | 873C0F541A20D360006BE395 = { 250 | CreatedOnToolsVersion = 6.1; 251 | TestTargetID = 873C0F3B1A20D35F006BE395; 252 | }; 253 | }; 254 | }; 255 | buildConfigurationList = 873C0F371A20D35F006BE395 /* Build configuration list for PBXProject "CircularProgressControl" */; 256 | compatibilityVersion = "Xcode 3.2"; 257 | developmentRegion = English; 258 | hasScannedForEncodings = 0; 259 | knownRegions = ( 260 | en, 261 | Base, 262 | pt, 263 | ); 264 | mainGroup = 873C0F331A20D35F006BE395; 265 | productRefGroup = 873C0F3D1A20D35F006BE395 /* Products */; 266 | projectDirPath = ""; 267 | projectRoot = ""; 268 | targets = ( 269 | 873C0F3B1A20D35F006BE395 /* CircularProgressControl */, 270 | 873C0F541A20D360006BE395 /* CircularProgressControlTests */, 271 | ); 272 | }; 273 | /* End PBXProject section */ 274 | 275 | /* Begin PBXResourcesBuildPhase section */ 276 | 873C0F3A1A20D35F006BE395 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 873C0F4B1A20D360006BE395 /* Main.storyboard in Resources */, 281 | 873C0F7A1A216BE9006BE395 /* Localizable.strings in Resources */, 282 | 873C0F501A20D360006BE395 /* LaunchScreen.xib in Resources */, 283 | 873C0F4D1A20D360006BE395 /* Images.xcassets in Resources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | 873C0F531A20D360006BE395 /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXResourcesBuildPhase section */ 295 | 296 | /* Begin PBXSourcesBuildPhase section */ 297 | 873C0F381A20D35F006BE395 /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | 873C0F731A20DE4A006BE395 /* ProgressViewController.m in Sources */, 302 | 873C0F451A20D360006BE395 /* AppDelegate.m in Sources */, 303 | 873C0F761A2159DB006BE395 /* Session.m in Sources */, 304 | 873C0F701A20D685006BE395 /* CircleProgressView.m in Sources */, 305 | 873C0F421A20D35F006BE395 /* main.m in Sources */, 306 | 873C0F6D1A20D593006BE395 /* CircleShapeLayer.m in Sources */, 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | 873C0F511A20D360006BE395 /* Sources */ = { 311 | isa = PBXSourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | 873C0F5C1A20D360006BE395 /* CircularProgressControlTests.m in Sources */, 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | /* End PBXSourcesBuildPhase section */ 319 | 320 | /* Begin PBXTargetDependency section */ 321 | 873C0F571A20D360006BE395 /* PBXTargetDependency */ = { 322 | isa = PBXTargetDependency; 323 | target = 873C0F3B1A20D35F006BE395 /* CircularProgressControl */; 324 | targetProxy = 873C0F561A20D360006BE395 /* PBXContainerItemProxy */; 325 | }; 326 | /* End PBXTargetDependency section */ 327 | 328 | /* Begin PBXVariantGroup section */ 329 | 873C0F491A20D360006BE395 /* Main.storyboard */ = { 330 | isa = PBXVariantGroup; 331 | children = ( 332 | 873C0F4A1A20D360006BE395 /* Base */, 333 | ); 334 | name = Main.storyboard; 335 | sourceTree = ""; 336 | }; 337 | 873C0F4E1A20D360006BE395 /* LaunchScreen.xib */ = { 338 | isa = PBXVariantGroup; 339 | children = ( 340 | 873C0F4F1A20D360006BE395 /* Base */, 341 | 873C0F7D1A2170A9006BE395 /* pt */, 342 | ); 343 | name = LaunchScreen.xib; 344 | sourceTree = ""; 345 | }; 346 | 873C0F7C1A216BE9006BE395 /* Localizable.strings */ = { 347 | isa = PBXVariantGroup; 348 | children = ( 349 | 873C0F7B1A216BE9006BE395 /* Base */, 350 | 873C0F7E1A2170AA006BE395 /* pt */, 351 | ); 352 | name = Localizable.strings; 353 | sourceTree = ""; 354 | }; 355 | /* End PBXVariantGroup section */ 356 | 357 | /* Begin XCBuildConfiguration section */ 358 | 873C0F5D1A20D360006BE395 /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ALWAYS_SEARCH_USER_PATHS = NO; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_CONSTANT_CONVERSION = YES; 368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 369 | CLANG_WARN_EMPTY_BODY = YES; 370 | CLANG_WARN_ENUM_CONVERSION = YES; 371 | CLANG_WARN_INT_CONVERSION = YES; 372 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 376 | COPY_PHASE_STRIP = NO; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | GCC_C_LANGUAGE_STANDARD = gnu99; 379 | GCC_DYNAMIC_NO_PIC = NO; 380 | GCC_OPTIMIZATION_LEVEL = 0; 381 | GCC_PREPROCESSOR_DEFINITIONS = ( 382 | "DEBUG=1", 383 | "$(inherited)", 384 | ); 385 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 386 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 387 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 388 | GCC_WARN_UNDECLARED_SELECTOR = YES; 389 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 390 | GCC_WARN_UNUSED_FUNCTION = YES; 391 | GCC_WARN_UNUSED_VARIABLE = YES; 392 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 393 | MTL_ENABLE_DEBUG_INFO = YES; 394 | ONLY_ACTIVE_ARCH = YES; 395 | SDKROOT = iphoneos; 396 | }; 397 | name = Debug; 398 | }; 399 | 873C0F5E1A20D360006BE395 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | ALWAYS_SEARCH_USER_PATHS = NO; 403 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 404 | CLANG_CXX_LIBRARY = "libc++"; 405 | CLANG_ENABLE_MODULES = YES; 406 | CLANG_ENABLE_OBJC_ARC = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_CONSTANT_CONVERSION = YES; 409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 410 | CLANG_WARN_EMPTY_BODY = YES; 411 | CLANG_WARN_ENUM_CONVERSION = YES; 412 | CLANG_WARN_INT_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = YES; 418 | ENABLE_NS_ASSERTIONS = NO; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | GCC_C_LANGUAGE_STANDARD = gnu99; 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 428 | MTL_ENABLE_DEBUG_INFO = NO; 429 | SDKROOT = iphoneos; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 873C0F601A20D360006BE395 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | CODE_SIGN_IDENTITY = "iPhone Developer"; 439 | INFOPLIST_FILE = CircularProgressControl/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_NAME = "$(TARGET_NAME)"; 442 | }; 443 | name = Debug; 444 | }; 445 | 873C0F611A20D360006BE395 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 449 | CODE_SIGN_IDENTITY = "iPhone Developer"; 450 | INFOPLIST_FILE = CircularProgressControl/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | }; 454 | name = Release; 455 | }; 456 | 873C0F631A20D360006BE395 /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | FRAMEWORK_SEARCH_PATHS = ( 461 | "$(SDKROOT)/Developer/Library/Frameworks", 462 | "$(inherited)", 463 | ); 464 | GCC_PREPROCESSOR_DEFINITIONS = ( 465 | "DEBUG=1", 466 | "$(inherited)", 467 | ); 468 | INFOPLIST_FILE = CircularProgressControlTests/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircularProgressControl.app/CircularProgressControl"; 472 | }; 473 | name = Debug; 474 | }; 475 | 873C0F641A20D360006BE395 /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | BUNDLE_LOADER = "$(TEST_HOST)"; 479 | FRAMEWORK_SEARCH_PATHS = ( 480 | "$(SDKROOT)/Developer/Library/Frameworks", 481 | "$(inherited)", 482 | ); 483 | INFOPLIST_FILE = CircularProgressControlTests/Info.plist; 484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircularProgressControl.app/CircularProgressControl"; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 873C0F371A20D35F006BE395 /* Build configuration list for PBXProject "CircularProgressControl" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 873C0F5D1A20D360006BE395 /* Debug */, 497 | 873C0F5E1A20D360006BE395 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 873C0F5F1A20D360006BE395 /* Build configuration list for PBXNativeTarget "CircularProgressControl" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 873C0F601A20D360006BE395 /* Debug */, 506 | 873C0F611A20D360006BE395 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | }; 510 | 873C0F621A20D360006BE395 /* Build configuration list for PBXNativeTarget "CircularProgressControlTests" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | 873C0F631A20D360006BE395 /* Debug */, 514 | 873C0F641A20D360006BE395 /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | }; 518 | /* End XCConfigurationList section */ 519 | }; 520 | rootObject = 873C0F341A20D35F006BE395 /* Project object */; 521 | } 522 | -------------------------------------------------------------------------------- /CircularProgressControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CircularProgressControl/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. 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 | -------------------------------------------------------------------------------- /CircularProgressControl/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. 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 | -------------------------------------------------------------------------------- /CircularProgressControl/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CircularProgressControl/Base.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | CircularProgressControl 4 | 5 | Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | Copyright (c) 2014 Mobistart. All rights reserved. 7 | */ 8 | 9 | "circle-progress-view.status-not-started" = "not started"; 10 | "circle-progress-view.status-in-progress" = "in progress"; 11 | "progress-view-controller.action-button.title-stop" = "Stop"; 12 | "progress-view-controller.action-button.title-start" = "Start"; 13 | -------------------------------------------------------------------------------- /CircularProgressControl/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /CircularProgressControl/CircularProgressView/CircleProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CircleProgressView.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CircleProgressView : UIControl 12 | 13 | @property (nonatomic) NSTimeInterval elapsedTime; 14 | 15 | @property (nonatomic) NSTimeInterval timeLimit; 16 | 17 | @property (nonatomic, retain) NSString *status; 18 | 19 | @property (assign, nonatomic, readonly) double percent; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CircularProgressControl/CircularProgressView/CircleProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CircleProgressView.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import "CircleProgressView.h" 10 | #import "CircleShapeLayer.h" 11 | 12 | @interface CircleProgressView() 13 | 14 | @property (nonatomic, strong) CircleShapeLayer *progressLayer; 15 | @property (strong, nonatomic) UILabel *progressLabel; 16 | 17 | @end 18 | 19 | @implementation CircleProgressView 20 | 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame 23 | { 24 | self = [super initWithFrame:frame]; 25 | if (self) { 26 | [self setupViews]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)awakeFromNib { 32 | [self setupViews]; 33 | } 34 | 35 | - (void)layoutSubviews { 36 | [super layoutSubviews]; 37 | 38 | self.progressLayer.frame = self.bounds; 39 | 40 | [self.progressLabel sizeToFit]; 41 | self.progressLabel.center = CGPointMake(self.center.x - self.frame.origin.x, self.center.y- self.frame.origin.y); 42 | } 43 | 44 | - (void)updateConstraints { 45 | [super updateConstraints]; 46 | } 47 | 48 | - (UILabel *)progressLabel 49 | { 50 | if (!_progressLabel) { 51 | _progressLabel = [[UILabel alloc] initWithFrame:self.bounds]; 52 | _progressLabel.numberOfLines = 2; 53 | _progressLabel.textAlignment = NSTextAlignmentCenter; 54 | _progressLabel.backgroundColor = [UIColor clearColor]; 55 | _progressLabel.textColor = [UIColor whiteColor]; 56 | 57 | [self addSubview:_progressLabel]; 58 | } 59 | 60 | return _progressLabel; 61 | } 62 | 63 | - (double)percent { 64 | return self.progressLayer.percent; 65 | } 66 | 67 | - (NSTimeInterval)timeLimit { 68 | return self.progressLayer.timeLimit; 69 | } 70 | 71 | - (void)setTimeLimit:(NSTimeInterval)timeLimit { 72 | self.progressLayer.timeLimit = timeLimit; 73 | } 74 | 75 | - (void)setElapsedTime:(NSTimeInterval)elapsedTime { 76 | _elapsedTime = elapsedTime; 77 | self.progressLayer.elapsedTime = elapsedTime; 78 | self.progressLabel.attributedText = [self formatProgressStringFromTimeInterval:elapsedTime]; 79 | } 80 | 81 | #pragma mark - Private Methods 82 | 83 | - (void)setupViews { 84 | 85 | self.backgroundColor = [UIColor clearColor]; 86 | self.clipsToBounds = false; 87 | 88 | //add Progress layer 89 | self.progressLayer = [[CircleShapeLayer alloc] init]; 90 | self.progressLayer.frame = self.bounds; 91 | self.progressLayer.backgroundColor = [UIColor clearColor].CGColor; 92 | [self.layer addSublayer:self.progressLayer]; 93 | 94 | } 95 | 96 | - (void)setTintColor:(UIColor *)tintColor { 97 | self.progressLayer.progressColor = tintColor; 98 | self.progressLabel.textColor = tintColor; 99 | } 100 | 101 | - (NSString *)stringFromTimeInterval:(NSTimeInterval)interval shortDate:(BOOL)shortDate { 102 | NSInteger ti = (NSInteger)interval; 103 | NSInteger seconds = ti % 60; 104 | NSInteger minutes = (ti / 60) % 60; 105 | NSInteger hours = (ti / 3600); 106 | 107 | if (shortDate) { 108 | return [NSString stringWithFormat:@"%02ld:%02ld", (long)hours, (long)minutes]; 109 | } 110 | else { 111 | return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", (long)hours, (long)minutes, (long)seconds]; 112 | } 113 | 114 | } 115 | 116 | - (NSAttributedString *)formatProgressStringFromTimeInterval:(NSTimeInterval)interval { 117 | 118 | NSString *progressString = [self stringFromTimeInterval:interval shortDate:false]; 119 | 120 | NSMutableAttributedString *attributedString; 121 | 122 | 123 | if (_status.length > 0) { 124 | 125 | attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@", progressString, _status]]; 126 | 127 | [attributedString addAttributes:@{ 128 | NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Bold" size:40]} 129 | range:NSMakeRange(0, progressString.length)]; 130 | 131 | [attributedString addAttributes:@{ 132 | NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-thin" size:18]} 133 | range:NSMakeRange(progressString.length+1, _status.length)]; 134 | 135 | } 136 | else 137 | { 138 | attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",progressString]]; 139 | 140 | [attributedString addAttributes:@{ 141 | NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Bold" size:18]} 142 | range:NSMakeRange(0, progressString.length)]; 143 | } 144 | 145 | return attributedString; 146 | } 147 | 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /CircularProgressControl/CircularProgressView/CircleShapeLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CircleShapeLayer.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface CircleShapeLayer : CAShapeLayer 14 | 15 | @property (nonatomic) NSTimeInterval elapsedTime; 16 | @property (nonatomic) NSTimeInterval timeLimit; 17 | @property (assign, nonatomic, readonly) double percent; 18 | @property (nonatomic) UIColor *progressColor; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CircularProgressControl/CircularProgressView/CircleShapeLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CircleShapeLayer.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import "CircleShapeLayer.h" 10 | 11 | @interface CircleShapeLayer () 12 | 13 | @property (assign, nonatomic) double initialProgress; 14 | @property (nonatomic, strong) CAShapeLayer *progressLayer; 15 | @property (nonatomic, assign) CGRect frame; 16 | 17 | @end 18 | 19 | @implementation CircleShapeLayer 20 | 21 | @synthesize percent = _percent; 22 | 23 | - (instancetype)init { 24 | if ((self = [super init])) 25 | { 26 | [self setupLayer]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (void)layoutSublayers { 33 | 34 | self.path = [self drawPathWithArcCenter]; 35 | self.progressLayer.path = [self drawPathWithArcCenter]; 36 | [super layoutSublayers]; 37 | } 38 | 39 | - (void)setupLayer { 40 | 41 | self.path = [self drawPathWithArcCenter]; 42 | self.fillColor = [UIColor clearColor].CGColor; 43 | self.strokeColor = [UIColor colorWithRed:0.86f green:0.86f blue:0.86f alpha:0.4f].CGColor; 44 | self.lineWidth = 20; 45 | 46 | self.progressLayer = [CAShapeLayer layer]; 47 | self.progressLayer.path = [self drawPathWithArcCenter]; 48 | self.progressLayer.fillColor = [UIColor clearColor].CGColor; 49 | self.progressLayer.strokeColor = [UIColor whiteColor].CGColor; 50 | self.progressLayer.lineWidth = 20; 51 | self.progressLayer.lineCap = kCALineCapRound; 52 | self.progressLayer.lineJoin = kCALineJoinRound; 53 | [self addSublayer:self.progressLayer]; 54 | 55 | } 56 | 57 | - (CGPathRef)drawPathWithArcCenter { 58 | 59 | CGFloat position_y = self.frame.size.height/2; 60 | CGFloat position_x = self.frame.size.width/2; // Assuming that width == height 61 | return [UIBezierPath bezierPathWithArcCenter:CGPointMake(position_x, position_y) 62 | radius:position_y 63 | startAngle:(-M_PI/2) 64 | endAngle:(3*M_PI/2) 65 | clockwise:YES].CGPath; 66 | } 67 | 68 | 69 | - (void)setElapsedTime:(NSTimeInterval)elapsedTime { 70 | _initialProgress = [self calculatePercent:_elapsedTime toTime:_timeLimit]; 71 | _elapsedTime = elapsedTime; 72 | 73 | self.progressLayer.strokeEnd = self.percent; 74 | [self startAnimation]; 75 | } 76 | 77 | - (double)percent { 78 | 79 | _percent = [self calculatePercent:_elapsedTime toTime:_timeLimit]; 80 | return _percent; 81 | } 82 | 83 | - (void)setProgressColor:(UIColor *)progressColor { 84 | self.progressLayer.strokeColor = progressColor.CGColor; 85 | } 86 | 87 | - (double)calculatePercent:(NSTimeInterval)fromTime toTime:(NSTimeInterval)toTime { 88 | 89 | if ((toTime > 0) && (fromTime > 0)) { 90 | 91 | CGFloat progress = 0; 92 | 93 | progress = fromTime / toTime; 94 | 95 | if ((progress * 100) > 100) { 96 | progress = 1.0f; 97 | } 98 | 99 | NSLog(@"Percent = %f", progress); 100 | 101 | return progress; 102 | } 103 | else 104 | return 0.0f; 105 | } 106 | 107 | - (void)startAnimation { 108 | 109 | CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 110 | pathAnimation.duration = 1.0; 111 | pathAnimation.fromValue = @(self.initialProgress); 112 | pathAnimation.toValue = @(self.percent); 113 | pathAnimation.removedOnCompletion = YES; 114 | 115 | [self.progressLayer addAnimation:pathAnimation forKey:nil]; 116 | 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /CircularProgressControl/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CircularProgressControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | mobistart.$(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 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CircularProgressControl/ProgressViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViewController.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CircleProgressView; 12 | 13 | @interface ProgressViewController : UIViewController 14 | 15 | @property (strong, nonatomic) IBOutlet CircleProgressView *circleProgressView; 16 | 17 | @property (strong, nonatomic) IBOutlet UIButton *actionButton; 18 | 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CircularProgressControl/ProgressViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViewController.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import "ProgressViewController.h" 10 | #import "CircleProgressView.h" 11 | #import "Session.h" 12 | 13 | @interface ProgressViewController () 14 | 15 | @property (strong, nonatomic) NSTimer *timer; 16 | @property (nonatomic) Session *session; 17 | 18 | @end 19 | 20 | @implementation ProgressViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | //View Background 26 | self.view.backgroundColor = [UIColor colorWithRed:51/255.0 green:73/255.0 blue:93/255.0 alpha:1.0]; 27 | 28 | self.session = [[Session alloc] init]; 29 | self.session.state = kSessionStateStop; 30 | 31 | self.circleProgressView.status = NSLocalizedString(@"circle-progress-view.status-not-started", nil); 32 | self.circleProgressView.timeLimit = 60*8; 33 | self.circleProgressView.elapsedTime = 0; 34 | 35 | [self.actionButton setTintColor:[UIColor whiteColor]]; 36 | 37 | [self startTimer]; 38 | } 39 | 40 | - (void)viewDidDisappear:(BOOL)animated { 41 | [self.timer invalidate]; 42 | } 43 | 44 | 45 | #pragma mark - Timer 46 | 47 | - (void)startTimer { 48 | if ((!self.timer) || (![self.timer isValid])) { 49 | 50 | self.timer = [NSTimer scheduledTimerWithTimeInterval:1.00 51 | target:self 52 | selector:@selector(poolTimer) 53 | userInfo:nil 54 | repeats:YES]; 55 | } 56 | } 57 | 58 | - (void)poolTimer 59 | { 60 | if ((self.session) && (self.session.state == kSessionStateStart)) 61 | { 62 | self.circleProgressView.elapsedTime = self.session.progressTime; 63 | } 64 | } 65 | 66 | 67 | #pragma mark - User Interaction 68 | 69 | - (IBAction)actionButtonClick:(id)sender { 70 | 71 | if (self.session.state == kSessionStateStop) { 72 | 73 | self.session.startDate = [NSDate date]; 74 | self.session.finishDate = nil; 75 | self.session.state = kSessionStateStart; 76 | 77 | UIColor *tintColor = [UIColor colorWithRed:184/255.0 green:233/255.0 blue:134/255.0 alpha:1.0]; 78 | self.circleProgressView.status = NSLocalizedString(@"circle-progress-view.status-in-progress", nil); 79 | self.circleProgressView.tintColor = tintColor; 80 | self.circleProgressView.elapsedTime = 0; 81 | 82 | [self.actionButton setTitle:NSLocalizedString(@"progress-view-controller.action-button.title-stop", nil) forState:UIControlStateNormal]; 83 | [self.actionButton setTintColor:tintColor]; 84 | } 85 | else { 86 | self.session.finishDate = [NSDate date]; 87 | self.session.state = kSessionStateStop; 88 | 89 | self.circleProgressView.status = NSLocalizedString(@"circle-progress-view.status-not-started", nil); 90 | self.circleProgressView.tintColor = [UIColor whiteColor]; 91 | self.circleProgressView.elapsedTime = self.session.progressTime; 92 | 93 | [self.actionButton setTitle:NSLocalizedString(@"progress-view-controller.action-button.title-start", nil) forState:UIControlStateNormal]; 94 | [self.actionButton setTintColor:[UIColor whiteColor]]; 95 | } 96 | } 97 | 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /CircularProgressControl/Session.h: -------------------------------------------------------------------------------- 1 | // 2 | // Session.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | kSessionStateStart = 0, 13 | kSessionStateStop = 1 14 | } SessionState; 15 | 16 | @interface Session : NSObject 17 | 18 | @property (nonatomic, retain) NSDate * startDate; 19 | @property (nonatomic, retain) NSDate * finishDate; 20 | @property (nonatomic, readonly) NSTimeInterval progressTime; 21 | @property (nonatomic) SessionState state; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CircularProgressControl/Session.m: -------------------------------------------------------------------------------- 1 | // 2 | // Session.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import "Session.h" 10 | 11 | @implementation Session 12 | 13 | - (NSTimeInterval)progressTime { 14 | 15 | if (_finishDate) { 16 | return [_finishDate timeIntervalSinceDate:self.startDate]; 17 | } 18 | else { 19 | return [[NSDate date] timeIntervalSinceDate:self.startDate]; 20 | } 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CircularProgressControl/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CircularProgressControl/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CircularProgressControl/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CircularProgressControl 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. 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 | -------------------------------------------------------------------------------- /CircularProgressControl/pt.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "IBUILabel"; text = " Copyright (c) 2014 Mobistart. All rights reserved."; ObjectID = "8ie-xW-0ye"; */ 3 | "8ie-xW-0ye.text" = " Copyright (c) 2014 Mobistart. Todos os direitos reservados."; 4 | 5 | /* Class = "IBUILabel"; text = "CircularProgressControl"; ObjectID = "kId-c2-rCX"; */ 6 | "kId-c2-rCX.text" = "CircularProgressControl"; 7 | -------------------------------------------------------------------------------- /CircularProgressControl/pt.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | CircularProgressControl 4 | 5 | Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | Copyright (c) 2014 Mobistart. All rights reserved. 7 | */ 8 | 9 | "circle-progress-view.status-not-started" = "não iniciado"; 10 | "circle-progress-view.status-in-progress" = "em andamento"; 11 | "progress-view-controller.action-button.title-stop" = "Parar"; 12 | "progress-view-controller.action-button.title-start" = "Iniciar"; 13 | -------------------------------------------------------------------------------- /CircularProgressControlTests/CircularProgressControlTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CircularProgressControlTests.m 3 | // CircularProgressControlTests 4 | // 5 | // Created by Carlos Eduardo Arantes Ferreira on 22/11/14. 6 | // Copyright (c) 2014 Mobistart. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CircularProgressControlTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation CircularProgressControlTests 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 | -------------------------------------------------------------------------------- /CircularProgressControlTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | mobistart.$(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 2014 Carlos Eduardo Arantes Ferreira 2 | 3 | Copyright (c) {{{year}}} {{{fullname}}} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CircularProgressControl 2 | 3 | *** 4 | 5 | This is a simple and adaptive Circular Progress View. 6 | 7 | It basically consists of two CAShapeLayers to draw a static and a animated circle, and a progress label with two lines, the first to describe a timer and the second for a state. 8 | 9 | ![Screenshot](https://cloud.githubusercontent.com/assets/1878740/5596864/2269a630-927f-11e4-8d3b-aa58ef0e3b8e.png) 10 | 11 | ## Features 12 | 13 | - automatically update the circle progress when the elapsed time is set 14 | - autolayout compatible 15 | - autoformat the timer label 16 | - tint color of progress layer and label 17 | - state description can be changed 18 | 19 | ## Installation 20 | 21 | Grab the files in `View/CircularProgressView` and put it in your 22 | project. The code uses ARC, so make sure to turn that on for the files if you're 23 | not already using ARC. 24 | 25 | ## Usage 26 | 27 | Subclass CircularProgressView or manually create a new instance using alloc/initWithFrame: 28 | ```objectivec 29 | CircleProgressView *progressView = [[CircleProgressView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; 30 | ``` 31 | Configure the parameters before set the elapsed time: 32 | ```objectivec 33 | [_circleProgressView setTimeLimit:3600*8]; 34 | [_circleProgressView setStatus:NSLocalizedString(@"circle-progress-view.status-not-started", nil)]; 35 | [_circleProgressView setTintColor:[UIColor whiteColor]]; 36 | [_circleProgressView setElapsedTime:0]; 37 | ``` 38 | 39 | ## Small Print 40 | 41 | ### License 42 | 43 | `CircularProgressView` is released under the MIT license. 44 | 45 | ### Author 46 | 47 | Carlos Arantes ([@carantes](http://twitter.com/carantes)) 48 | 49 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/carantes/circularprogresscontrol/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 50 | --------------------------------------------------------------------------------