├── README.markdown ├── RoundProgress.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── renaud.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── renaud.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── RoundProgress.xcscheme │ └── xcschememanagement.plist └── RoundProgress ├── CEAppDelegate.h ├── CEAppDelegate.m ├── CEPlayer.h ├── CEPlayer.m ├── CERoundProgressLayer.h ├── CERoundProgressLayer.m ├── CERoundProgressView.h ├── CERoundProgressView.m ├── CEViewController.h ├── CEViewController.m ├── RoundProgress-Info.plist ├── RoundProgress-Prefix.pch ├── en.lproj ├── CEViewController.xib └── InfoPlist.strings ├── images ├── Pause.png ├── Pause@2x.png ├── Play.png └── Play@2x.png └── main.m /README.markdown: -------------------------------------------------------------------------------- 1 | # CERoundProgressView # 2 | 3 | CERoundProgressView shows a progress as a pie share diagram. While it does not inherit UIProgressView, its API is quite similar. 4 | 5 | The view is graphically very simple, consisting of only a background circle and a coloured arc: 6 | 7 | ![A CERoundProgressView on its own](http://www.ceroce.com/github/CEProgressView/ProgressViewAlone.png) 8 | 9 | However, used in conjunction with other elements, it becomes quite interesting. For example, the sample program uses it as the background of a button which uses an image, transparent in some parts: 10 | 11 | ![A CERoundProgressView used with a button](http://www.ceroce.com/github/CEProgressView/ProgressViewWithButton.png) 12 | 13 | 14 | ### Particular Features ### 15 | 16 | * The change of progress is animated. 17 | * Colours can be set, either individually or through the UIAppearance proxy. 18 | 19 | 20 | ## How to use ## 21 | 22 | Drag the following files to your Xcode project: 23 | * CERoundProgressView.h and .m 24 | * CERoundProgressLayer.h and .m 25 | 26 | Because the progress view uses Core Animation, your target must also link with the QuartzCore framework. 27 | 28 | ### Duration of the animation ### 29 | I could not find a way to add a custom animatable property to a UIView. As a result, the following sample code has no effect on the animation's duration: 30 | 31 | [UIView animateWithDuration:3.0 animations:^{ 32 | self.roundProgressView.progress = 12.0; 33 | }]; 34 | 35 | Therefore, CERoundProgressView an animationDuration property was added for that purpose. 36 | 37 | ## Compatibility ## 38 | 39 | CERoundProgressView is compatible with iOS 5 and iOS 6. 40 | 41 | #### Automatic Reference Counting #### 42 | ARC is not enabled in the sample project, and the classes manage memory the old way. 43 | 44 | If ARC is activated in your project, the compiler will complain about the -dealloc method in CERoundProgressLayer.m. You should disable ARC for this file using the -fno-objc-arc compiler flag. 45 | 46 | #### Older SDKs #### 47 | 48 | CERoundProgressView makes use of the UIAppearance API which is only available from iOS 5.0. Should you want to link with older SDKs, you may modify CERoundProgressView.h so the class does not conform to the UIAppearanceContainer protocol, and its properties are not declared as UI_APPEARANCE_SELECTOR. 49 | 50 | ## Sample project ## 51 | 52 | The sample program shows a button which toggles between Play and Pause. The CERoundProgressView is below it. 53 | 54 | * CEPlayer is the most interesting class. It makes its position evolve from 0 to 1 on a duration of 20 seconds. The position changes abruptly every 0.5 s, on purpose: you can notice that the slider jumps from value to value, while the progress view animates smoothly. 55 | 56 | * CEViewController is the delegate of CEPlayer. Its purpose is to catch the actions of the button and set the progress of the slider and the progress view. 57 | 58 | 59 | ## License ## 60 | 61 | Copyright (c) 2012, Céroce. All rights reserved. 62 | 63 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 64 | 65 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 66 | 67 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 68 | 69 | 3. Neither the name of Céroce nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 70 | 71 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CÉROCE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 72 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E2263E10157CF7FA00558AD8 /* Pause.png in Resources */ = {isa = PBXBuildFile; fileRef = E2263E0C157CF7FA00558AD8 /* Pause.png */; }; 11 | E2263E11157CF7FA00558AD8 /* Pause@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E2263E0D157CF7FA00558AD8 /* Pause@2x.png */; }; 12 | E2263E12157CF7FA00558AD8 /* Play.png in Resources */ = {isa = PBXBuildFile; fileRef = E2263E0E157CF7FA00558AD8 /* Play.png */; }; 13 | E2263E13157CF7FA00558AD8 /* Play@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E2263E0F157CF7FA00558AD8 /* Play@2x.png */; }; 14 | E2263E17157CFC9300558AD8 /* CEPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E2263E16157CFC9300558AD8 /* CEPlayer.m */; }; 15 | E230F6C1156F9B1D00D2B84B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E230F6C0156F9B1D00D2B84B /* UIKit.framework */; }; 16 | E230F6C3156F9B1D00D2B84B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E230F6C2156F9B1D00D2B84B /* Foundation.framework */; }; 17 | E230F6C5156F9B1D00D2B84B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E230F6C4156F9B1D00D2B84B /* CoreGraphics.framework */; }; 18 | E230F6CB156F9B1D00D2B84B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E230F6C9156F9B1D00D2B84B /* InfoPlist.strings */; }; 19 | E230F6CD156F9B1D00D2B84B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E230F6CC156F9B1D00D2B84B /* main.m */; }; 20 | E230F6D1156F9B1D00D2B84B /* CEAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E230F6D0156F9B1D00D2B84B /* CEAppDelegate.m */; }; 21 | E230F6D4156F9B1D00D2B84B /* CEViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E230F6D3156F9B1D00D2B84B /* CEViewController.m */; }; 22 | E230F6D7156F9B1D00D2B84B /* CEViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E230F6D5156F9B1D00D2B84B /* CEViewController.xib */; }; 23 | E230F6DF156F9B4300D2B84B /* CERoundProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = E230F6DE156F9B4300D2B84B /* CERoundProgressView.m */; }; 24 | E2AEED331588A30900733008 /* CERoundProgressLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E2AEED321588A30900733008 /* CERoundProgressLayer.m */; }; 25 | E2AEED361588A35000733008 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2AEED351588A35000733008 /* QuartzCore.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | E2263E0C157CF7FA00558AD8 /* Pause.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Pause.png; sourceTree = ""; }; 30 | E2263E0D157CF7FA00558AD8 /* Pause@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Pause@2x.png"; sourceTree = ""; }; 31 | E2263E0E157CF7FA00558AD8 /* Play.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Play.png; sourceTree = ""; }; 32 | E2263E0F157CF7FA00558AD8 /* Play@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Play@2x.png"; sourceTree = ""; }; 33 | E2263E15157CFC9300558AD8 /* CEPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEPlayer.h; sourceTree = ""; }; 34 | E2263E16157CFC9300558AD8 /* CEPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEPlayer.m; sourceTree = ""; }; 35 | E230F6BC156F9B1D00D2B84B /* RoundProgress.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RoundProgress.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | E230F6C0156F9B1D00D2B84B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 37 | E230F6C2156F9B1D00D2B84B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 38 | E230F6C4156F9B1D00D2B84B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 39 | E230F6C8156F9B1D00D2B84B /* RoundProgress-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RoundProgress-Info.plist"; sourceTree = ""; }; 40 | E230F6CA156F9B1D00D2B84B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 41 | E230F6CC156F9B1D00D2B84B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | E230F6CE156F9B1D00D2B84B /* RoundProgress-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RoundProgress-Prefix.pch"; sourceTree = ""; }; 43 | E230F6CF156F9B1D00D2B84B /* CEAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CEAppDelegate.h; sourceTree = ""; }; 44 | E230F6D0156F9B1D00D2B84B /* CEAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CEAppDelegate.m; sourceTree = ""; }; 45 | E230F6D2156F9B1D00D2B84B /* CEViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CEViewController.h; sourceTree = ""; }; 46 | E230F6D3156F9B1D00D2B84B /* CEViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CEViewController.m; sourceTree = ""; }; 47 | E230F6D6156F9B1D00D2B84B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/CEViewController.xib; sourceTree = ""; }; 48 | E230F6DD156F9B4300D2B84B /* CERoundProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CERoundProgressView.h; sourceTree = ""; }; 49 | E230F6DE156F9B4300D2B84B /* CERoundProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CERoundProgressView.m; sourceTree = ""; }; 50 | E2AEED311588A30900733008 /* CERoundProgressLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CERoundProgressLayer.h; sourceTree = ""; }; 51 | E2AEED321588A30900733008 /* CERoundProgressLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CERoundProgressLayer.m; sourceTree = ""; }; 52 | E2AEED351588A35000733008 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | E230F6B9156F9B1D00D2B84B /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | E2AEED361588A35000733008 /* QuartzCore.framework in Frameworks */, 61 | E230F6C1156F9B1D00D2B84B /* UIKit.framework in Frameworks */, 62 | E230F6C3156F9B1D00D2B84B /* Foundation.framework in Frameworks */, 63 | E230F6C5156F9B1D00D2B84B /* CoreGraphics.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | E2263E0B157CF7FA00558AD8 /* images */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | E2263E0C157CF7FA00558AD8 /* Pause.png */, 74 | E2263E0D157CF7FA00558AD8 /* Pause@2x.png */, 75 | E2263E0E157CF7FA00558AD8 /* Play.png */, 76 | E2263E0F157CF7FA00558AD8 /* Play@2x.png */, 77 | ); 78 | path = images; 79 | sourceTree = ""; 80 | }; 81 | E2263E18157D006300558AD8 /* Controller */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | E230F6CF156F9B1D00D2B84B /* CEAppDelegate.h */, 85 | E230F6D0156F9B1D00D2B84B /* CEAppDelegate.m */, 86 | E230F6D2156F9B1D00D2B84B /* CEViewController.h */, 87 | E230F6D3156F9B1D00D2B84B /* CEViewController.m */, 88 | E230F6D5156F9B1D00D2B84B /* CEViewController.xib */, 89 | ); 90 | name = Controller; 91 | sourceTree = ""; 92 | }; 93 | E2263E19157D006A00558AD8 /* Model */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | E2263E15157CFC9300558AD8 /* CEPlayer.h */, 97 | E2263E16157CFC9300558AD8 /* CEPlayer.m */, 98 | ); 99 | name = Model; 100 | sourceTree = ""; 101 | }; 102 | E2263E1A157D007100558AD8 /* View */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | E230F6DD156F9B4300D2B84B /* CERoundProgressView.h */, 106 | E230F6DE156F9B4300D2B84B /* CERoundProgressView.m */, 107 | E2AEED311588A30900733008 /* CERoundProgressLayer.h */, 108 | E2AEED321588A30900733008 /* CERoundProgressLayer.m */, 109 | ); 110 | name = View; 111 | sourceTree = ""; 112 | }; 113 | E230F6B1156F9B1C00D2B84B = { 114 | isa = PBXGroup; 115 | children = ( 116 | E230F6C6156F9B1D00D2B84B /* RoundProgress */, 117 | E230F6BF156F9B1D00D2B84B /* Frameworks */, 118 | E230F6BD156F9B1D00D2B84B /* Products */, 119 | ); 120 | sourceTree = ""; 121 | }; 122 | E230F6BD156F9B1D00D2B84B /* Products */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | E230F6BC156F9B1D00D2B84B /* RoundProgress.app */, 126 | ); 127 | name = Products; 128 | sourceTree = ""; 129 | }; 130 | E230F6BF156F9B1D00D2B84B /* Frameworks */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | E2AEED351588A35000733008 /* QuartzCore.framework */, 134 | E230F6C0156F9B1D00D2B84B /* UIKit.framework */, 135 | E230F6C2156F9B1D00D2B84B /* Foundation.framework */, 136 | E230F6C4156F9B1D00D2B84B /* CoreGraphics.framework */, 137 | ); 138 | name = Frameworks; 139 | sourceTree = ""; 140 | }; 141 | E230F6C6156F9B1D00D2B84B /* RoundProgress */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | E2263E1A157D007100558AD8 /* View */, 145 | E2263E18157D006300558AD8 /* Controller */, 146 | E2263E19157D006A00558AD8 /* Model */, 147 | E2263E0B157CF7FA00558AD8 /* images */, 148 | E230F6C7156F9B1D00D2B84B /* Supporting Files */, 149 | ); 150 | path = RoundProgress; 151 | sourceTree = ""; 152 | }; 153 | E230F6C7156F9B1D00D2B84B /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | E230F6C8156F9B1D00D2B84B /* RoundProgress-Info.plist */, 157 | E230F6C9156F9B1D00D2B84B /* InfoPlist.strings */, 158 | E230F6CC156F9B1D00D2B84B /* main.m */, 159 | E230F6CE156F9B1D00D2B84B /* RoundProgress-Prefix.pch */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | /* End PBXGroup section */ 165 | 166 | /* Begin PBXNativeTarget section */ 167 | E230F6BB156F9B1D00D2B84B /* RoundProgress */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = E230F6DA156F9B1D00D2B84B /* Build configuration list for PBXNativeTarget "RoundProgress" */; 170 | buildPhases = ( 171 | E230F6B8156F9B1D00D2B84B /* Sources */, 172 | E230F6B9156F9B1D00D2B84B /* Frameworks */, 173 | E230F6BA156F9B1D00D2B84B /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | ); 179 | name = RoundProgress; 180 | productName = RoundProgress; 181 | productReference = E230F6BC156F9B1D00D2B84B /* RoundProgress.app */; 182 | productType = "com.apple.product-type.application"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | E230F6B3156F9B1C00D2B84B /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | CLASSPREFIX = CE; 191 | LastUpgradeCheck = 0430; 192 | ORGANIZATIONNAME = "Céroce"; 193 | }; 194 | buildConfigurationList = E230F6B6156F9B1C00D2B84B /* Build configuration list for PBXProject "RoundProgress" */; 195 | compatibilityVersion = "Xcode 3.2"; 196 | developmentRegion = English; 197 | hasScannedForEncodings = 0; 198 | knownRegions = ( 199 | en, 200 | ); 201 | mainGroup = E230F6B1156F9B1C00D2B84B; 202 | productRefGroup = E230F6BD156F9B1D00D2B84B /* Products */; 203 | projectDirPath = ""; 204 | projectRoot = ""; 205 | targets = ( 206 | E230F6BB156F9B1D00D2B84B /* RoundProgress */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | E230F6BA156F9B1D00D2B84B /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | E230F6CB156F9B1D00D2B84B /* InfoPlist.strings in Resources */, 217 | E230F6D7156F9B1D00D2B84B /* CEViewController.xib in Resources */, 218 | E2263E10157CF7FA00558AD8 /* Pause.png in Resources */, 219 | E2263E11157CF7FA00558AD8 /* Pause@2x.png in Resources */, 220 | E2263E12157CF7FA00558AD8 /* Play.png in Resources */, 221 | E2263E13157CF7FA00558AD8 /* Play@2x.png in Resources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | /* End PBXResourcesBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | E230F6B8156F9B1D00D2B84B /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | E230F6CD156F9B1D00D2B84B /* main.m in Sources */, 233 | E230F6D1156F9B1D00D2B84B /* CEAppDelegate.m in Sources */, 234 | E230F6D4156F9B1D00D2B84B /* CEViewController.m in Sources */, 235 | E230F6DF156F9B4300D2B84B /* CERoundProgressView.m in Sources */, 236 | E2263E17157CFC9300558AD8 /* CEPlayer.m in Sources */, 237 | E2AEED331588A30900733008 /* CERoundProgressLayer.m in Sources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXSourcesBuildPhase section */ 242 | 243 | /* Begin PBXVariantGroup section */ 244 | E230F6C9156F9B1D00D2B84B /* InfoPlist.strings */ = { 245 | isa = PBXVariantGroup; 246 | children = ( 247 | E230F6CA156F9B1D00D2B84B /* en */, 248 | ); 249 | name = InfoPlist.strings; 250 | sourceTree = ""; 251 | }; 252 | E230F6D5156F9B1D00D2B84B /* CEViewController.xib */ = { 253 | isa = PBXVariantGroup; 254 | children = ( 255 | E230F6D6156F9B1D00D2B84B /* en */, 256 | ); 257 | name = CEViewController.xib; 258 | sourceTree = ""; 259 | }; 260 | /* End PBXVariantGroup section */ 261 | 262 | /* Begin XCBuildConfiguration section */ 263 | E230F6D8156F9B1D00D2B84B /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 268 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 269 | COPY_PHASE_STRIP = NO; 270 | GCC_C_LANGUAGE_STANDARD = gnu99; 271 | GCC_DYNAMIC_NO_PIC = NO; 272 | GCC_OPTIMIZATION_LEVEL = 0; 273 | GCC_PREPROCESSOR_DEFINITIONS = ( 274 | "DEBUG=1", 275 | "$(inherited)", 276 | ); 277 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 278 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 283 | SDKROOT = iphoneos; 284 | }; 285 | name = Debug; 286 | }; 287 | E230F6D9156F9B1D00D2B84B /* Release */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ALWAYS_SEARCH_USER_PATHS = NO; 291 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 292 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 293 | COPY_PHASE_STRIP = YES; 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 300 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 301 | SDKROOT = iphoneos; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Release; 305 | }; 306 | E230F6DB156F9B1D00D2B84B /* Debug */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 310 | GCC_PREFIX_HEADER = "RoundProgress/RoundProgress-Prefix.pch"; 311 | INFOPLIST_FILE = "RoundProgress/RoundProgress-Info.plist"; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | WRAPPER_EXTENSION = app; 314 | }; 315 | name = Debug; 316 | }; 317 | E230F6DC156F9B1D00D2B84B /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = "RoundProgress/RoundProgress-Prefix.pch"; 322 | INFOPLIST_FILE = "RoundProgress/RoundProgress-Info.plist"; 323 | PRODUCT_NAME = "$(TARGET_NAME)"; 324 | WRAPPER_EXTENSION = app; 325 | }; 326 | name = Release; 327 | }; 328 | /* End XCBuildConfiguration section */ 329 | 330 | /* Begin XCConfigurationList section */ 331 | E230F6B6156F9B1C00D2B84B /* Build configuration list for PBXProject "RoundProgress" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | E230F6D8156F9B1D00D2B84B /* Debug */, 335 | E230F6D9156F9B1D00D2B84B /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | E230F6DA156F9B1D00D2B84B /* Build configuration list for PBXNativeTarget "RoundProgress" */ = { 341 | isa = XCConfigurationList; 342 | buildConfigurations = ( 343 | E230F6DB156F9B1D00D2B84B /* Debug */, 344 | E230F6DC156F9B1D00D2B84B /* Release */, 345 | ); 346 | defaultConfigurationIsVisible = 0; 347 | defaultConfigurationName = Release; 348 | }; 349 | /* End XCConfigurationList section */ 350 | }; 351 | rootObject = E230F6B3156F9B1C00D2B84B /* Project object */; 352 | } 353 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/project.xcworkspace/xcuserdata/renaud.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ceroce/CERoundProgressView/8282b0ef0ea82d55a0040336a93a5e7904bf6666/RoundProgress.xcodeproj/project.xcworkspace/xcuserdata/renaud.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/project.xcworkspace/xcuserdata/renaud.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/xcuserdata/renaud.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/xcuserdata/renaud.xcuserdatad/xcschemes/RoundProgress.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /RoundProgress.xcodeproj/xcuserdata/renaud.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RoundProgress.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E230F6BB156F9B1D00D2B84B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RoundProgress/CEAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CEAppDelegate.h 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CEViewController; 12 | 13 | @interface CEAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) CEViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RoundProgress/CEAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CEAppDelegate.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import "CEAppDelegate.h" 10 | 11 | #import "CEViewController.h" 12 | 13 | @implementation CEAppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (void)dealloc 19 | { 20 | [_window release]; 21 | [_viewController release]; 22 | [super dealloc]; 23 | } 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 28 | // Override point for customization after application launch. 29 | self.viewController = [[[CEViewController alloc] initWithNibName:@"CEViewController" bundle:nil] autorelease]; 30 | self.window.rootViewController = self.viewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application 36 | { 37 | // 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. 38 | // 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. 39 | } 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application 42 | { 43 | // 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. 44 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 45 | } 46 | 47 | - (void)applicationWillEnterForeground:(UIApplication *)application 48 | { 49 | // 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. 50 | } 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application 53 | { 54 | // 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. 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application 58 | { 59 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /RoundProgress/CEPlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CEPlayer.h 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 04/06/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CEPlayer; 12 | 13 | @protocol CEPlayerDelegate 14 | 15 | - (void) player:(CEPlayer *)player didReachPosition:(float)position; 16 | - (void) playerDidStop:(CEPlayer *)player; 17 | 18 | @end 19 | 20 | @interface CEPlayer : NSObject 21 | 22 | - (void) play; 23 | - (void) pause; 24 | @property (assign) float position; // 0..1 25 | @property (retain) id delegate; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RoundProgress/CEPlayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CEPlayer.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 04/06/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import "CEPlayer.h" 10 | 11 | #define DURATION 20.0 12 | #define PERIOD 0.5 13 | 14 | @interface CEPlayer () 15 | { 16 | NSTimer *timer; 17 | } 18 | 19 | 20 | @end 21 | 22 | @implementation CEPlayer 23 | 24 | - (void)dealloc 25 | { 26 | [timer invalidate]; 27 | 28 | [super dealloc]; 29 | } 30 | 31 | - (void) play 32 | { 33 | if(timer) 34 | return; 35 | 36 | timer = [NSTimer scheduledTimerWithTimeInterval:PERIOD target:self selector:@selector(timerDidFire:) userInfo:nil repeats:YES]; 37 | } 38 | - (void) pause 39 | { 40 | [timer invalidate]; 41 | timer = nil; 42 | } 43 | 44 | - (void) timerDidFire:(NSTimer *)theTimer 45 | { 46 | if(self.position >= 1.0) 47 | { 48 | self.position = 0.0; 49 | [timer invalidate]; 50 | timer = nil; 51 | [self.delegate playerDidStop:self]; 52 | } 53 | else 54 | { 55 | self.position += PERIOD/DURATION; 56 | [self.delegate player:self didReachPosition:self.position]; 57 | } 58 | } 59 | 60 | @synthesize position; // 0..1 61 | 62 | @synthesize delegate; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /RoundProgress/CERoundProgressLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CERoundProgressLayer.h 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 13/06/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CERoundProgressLayer : CALayer 12 | 13 | @property (nonatomic, assign) float progress; 14 | 15 | @property (nonatomic, assign) float startAngle; 16 | @property (nonatomic, retain) UIColor *tintColor; 17 | @property (nonatomic, retain) UIColor *trackColor; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RoundProgress/CERoundProgressLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CERoundProgressLayer.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 13/06/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import "CERoundProgressLayer.h" 10 | 11 | @implementation CERoundProgressLayer 12 | 13 | @synthesize progress; 14 | @synthesize startAngle; 15 | @synthesize tintColor; 16 | @synthesize trackColor; 17 | 18 | - (id) initWithLayer:(id)layer 19 | { 20 | self = [super initWithLayer:layer]; 21 | if(self) 22 | { 23 | // Typically, the method is called to create the Presentation layer. 24 | // We must copy the parameters to look the same. 25 | if([layer isKindOfClass:[CERoundProgressLayer class]]) 26 | { 27 | CERoundProgressLayer *otherLayer = layer; 28 | 29 | 30 | self.progress = otherLayer.progress; 31 | self.startAngle = otherLayer.startAngle; 32 | self.tintColor = otherLayer.tintColor; 33 | self.trackColor = otherLayer.trackColor; 34 | } 35 | } 36 | 37 | return self; 38 | } 39 | 40 | - (void)dealloc 41 | { 42 | self.tintColor = nil; 43 | self.trackColor = nil; 44 | 45 | [super dealloc]; 46 | } 47 | 48 | + (BOOL) needsDisplayForKey:(NSString *)key 49 | { 50 | if([key isEqualToString:@"progress"]) 51 | return YES; 52 | else 53 | return [super needsDisplayForKey:key]; 54 | } 55 | 56 | - (void) drawInContext:(CGContextRef)context 57 | { 58 | CGFloat radius = MIN(self.bounds.size.width, self.bounds.size.height)/2.0; 59 | CGPoint center = CGPointMake(self.bounds.size.width/2.0, self.bounds.size.height/2.0); 60 | 61 | // Background circle 62 | CGRect circleRect = CGRectMake(center.x-radius, center.y-radius, radius*2.0, radius*2.0); 63 | CGContextAddEllipseInRect(context, circleRect); 64 | 65 | CGContextSetFillColorWithColor(context, trackColor.CGColor); 66 | CGContextFillPath(context); 67 | 68 | // Elapsed arc 69 | CGContextAddArc(context, center.x, center.y, radius, startAngle, startAngle + progress*2.0*M_PI, 0); 70 | CGContextAddLineToPoint(context, center.x, center.y); 71 | CGContextClosePath(context); 72 | 73 | CGContextSetFillColorWithColor(context, tintColor.CGColor); 74 | CGContextFillPath(context); 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /RoundProgress/CERoundProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CERoundProgressView.h 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CERoundProgressView : UIView 12 | 13 | @property (nonatomic, assign) float progress; // 0 .. 1 14 | - (void) setProgress:(float)progress animated:(BOOL)animated; 15 | 16 | @property (nonatomic, assign) float startAngle; // 0..2π 17 | @property (nonatomic, retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; 18 | @property (nonatomic, retain) UIColor *trackColor UI_APPEARANCE_SELECTOR; 19 | @property (nonatomic, assign) CFTimeInterval animationDuration; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /RoundProgress/CERoundProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CERoundProgressView.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import "CERoundProgressView.h" 10 | #import "CERoundProgressLayer.h" 11 | 12 | const NSTimeInterval CERoundProgressLayerDefaultAnimationDuration = 0.25; 13 | 14 | @interface CERoundProgressView () 15 | 16 | - (void) _initIVars; 17 | 18 | @end 19 | 20 | @implementation CERoundProgressView 21 | 22 | @synthesize animationDuration = _animationDuration; 23 | 24 | + (Class) layerClass 25 | { 26 | return [CERoundProgressLayer class]; 27 | } 28 | 29 | - (id)initWithFrame:(CGRect)frame 30 | { 31 | self = [super initWithFrame:frame]; 32 | if (self) { 33 | [self _initIVars]; 34 | } 35 | return self; 36 | } 37 | 38 | - (id) initWithCoder:(NSCoder *)aDecoder 39 | { 40 | self = [super initWithCoder:aDecoder]; 41 | if(self) { 42 | [self _initIVars]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void) _initIVars 48 | { 49 | _animationDuration = CERoundProgressLayerDefaultAnimationDuration; 50 | self.backgroundColor = [UIColor clearColor]; 51 | self.opaque = NO; 52 | self.tintColor = [UIColor colorWithRed:0.2 green:0.45 blue:0.8 alpha:1.0]; 53 | self.trackColor = [UIColor whiteColor]; 54 | 55 | // On Retina displays, the layer must have its resolution doubled so it does not look blocky. 56 | self.layer.contentsScale = [UIScreen mainScreen].scale; 57 | } 58 | 59 | 60 | - (float) progress 61 | { 62 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 63 | return layer.progress; 64 | } 65 | 66 | - (void) setProgress:(float)progress 67 | { 68 | BOOL growing = progress > self.progress; 69 | [self setProgress:progress animated:growing]; 70 | } 71 | 72 | - (void) setProgress:(float)progress animated:(BOOL)animated 73 | { 74 | // Coerce the value 75 | if(progress < 0.0f) 76 | progress = 0.0f; 77 | else if(progress > 1.0f) 78 | progress = 1.0f; 79 | 80 | // Apply to the layer 81 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 82 | if(animated) 83 | { 84 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"progress"]; 85 | animation.duration = self.animationDuration; 86 | animation.fromValue = [NSNumber numberWithFloat:layer.progress]; 87 | animation.toValue = [NSNumber numberWithFloat:progress]; 88 | [layer addAnimation:animation forKey:@"progressAnimation"]; 89 | 90 | layer.progress = progress; 91 | } 92 | 93 | else { 94 | layer.progress = progress; 95 | [layer setNeedsDisplay]; 96 | } 97 | } 98 | 99 | - (UIColor *)tintColor 100 | { 101 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 102 | return layer.tintColor; 103 | } 104 | - (void) setTintColor:(UIColor *)tintColor 105 | { 106 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 107 | layer.tintColor = tintColor; 108 | [layer setNeedsDisplay]; 109 | } 110 | 111 | - (UIColor *)trackColor 112 | { 113 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 114 | return layer.trackColor; 115 | } 116 | 117 | - (void) setTrackColor:(UIColor *)trackColor 118 | { 119 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 120 | layer.trackColor = trackColor; 121 | [layer setNeedsDisplay]; 122 | } 123 | 124 | 125 | - (float) startAngle 126 | { 127 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 128 | return layer.startAngle; 129 | } 130 | 131 | - (void) setStartAngle:(float)startAngle 132 | { 133 | CERoundProgressLayer *layer = (CERoundProgressLayer *)self.layer; 134 | layer.startAngle = startAngle; 135 | [layer setNeedsDisplay]; 136 | } 137 | 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /RoundProgress/CEViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CEViewController.h 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CERoundProgressView.h" 11 | #import "CEPlayer.h" 12 | 13 | @interface CEViewController : UIViewController 14 | 15 | 16 | @property (retain, nonatomic) IBOutlet CERoundProgressView *progressView; 17 | @property (retain, nonatomic) IBOutlet UISlider *progressSlider; 18 | - (IBAction)progressSlider:(UISlider *)sender; 19 | - (IBAction)playPauseButton:(UIButton *)sender; 20 | @property (retain, nonatomic) IBOutlet UIButton *playPauseButton; 21 | 22 | @property (retain, nonatomic) CEPlayer *player; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RoundProgress/CEViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CEViewController.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import "CEViewController.h" 10 | 11 | @interface CEViewController () 12 | { 13 | 14 | } 15 | 16 | 17 | @end 18 | 19 | @implementation CEViewController 20 | 21 | @synthesize progressView; 22 | @synthesize progressSlider; 23 | @synthesize playPauseButton; 24 | @synthesize player; 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | // Do any additional setup after loading the view, typically from a nib. 30 | 31 | self.player = [[[CEPlayer alloc] init] autorelease]; 32 | self.player.delegate = self; 33 | 34 | UIColor *tintColor = [UIColor orangeColor]; 35 | [[UISlider appearance] setMinimumTrackTintColor:tintColor]; 36 | [[CERoundProgressView appearance] setTintColor:tintColor]; 37 | 38 | self.progressView.trackColor = [UIColor colorWithWhite:0.80 alpha:1.0]; 39 | 40 | self.progressView.startAngle = (3.0*M_PI)/2.0; 41 | } 42 | 43 | - (void)viewDidUnload 44 | { 45 | [self setProgressView:nil]; 46 | [self setProgressSlider:nil]; 47 | [self setPlayPauseButton:nil]; 48 | [super viewDidUnload]; 49 | // Release any retained subviews of the main view. 50 | } 51 | 52 | - (void)dealloc { 53 | [progressView release]; 54 | [progressSlider release]; 55 | self.player = nil; 56 | [playPauseButton release]; 57 | [super dealloc]; 58 | } 59 | 60 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 61 | { 62 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 63 | } 64 | 65 | - (IBAction)progressSlider:(UISlider *)sender 66 | { 67 | self.player.position = sender.value; 68 | self.progressView.progress = sender.value; 69 | } 70 | 71 | - (IBAction)playPauseButton:(UIButton *)sender 72 | { 73 | if(sender.selected) // Shows the Pause symbol 74 | { 75 | sender.selected = NO; 76 | [self.player pause]; 77 | } 78 | else // Shows the Play symbol 79 | { 80 | sender.selected = YES; 81 | [self.player play]; 82 | } 83 | } 84 | 85 | 86 | 87 | // MARK: CEPlayerDelegate methods 88 | 89 | - (void) player:(CEPlayer *)player didReachPosition:(float)position 90 | { 91 | self.progressView.progress = position; 92 | self.progressSlider.value = position; 93 | } 94 | 95 | - (void) playerDidStop:(CEPlayer *)player 96 | { 97 | self.playPauseButton.selected = NO; 98 | self.progressView.progress = 0.0; 99 | self.progressSlider.value = 0.0; 100 | } 101 | @end 102 | -------------------------------------------------------------------------------- /RoundProgress/RoundProgress-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.ceroce.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /RoundProgress/RoundProgress-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'RoundProgress' target in the 'RoundProgress' 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 | -------------------------------------------------------------------------------- /RoundProgress/en.lproj/CEViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12D78 6 | 3084 7 | 1187.37 8 | 626.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBProxyObject 15 | IBUIButton 16 | IBUISlider 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 292 42 | {{18, 103}, {284, 23}} 43 | 44 | 45 | _NS:9 46 | NO 47 | IBCocoaTouchFramework 48 | 0 49 | 0 50 | 51 | 52 | 53 | 292 54 | {{127, 27}, {52, 51}} 55 | 56 | 57 | 58 | _NS:9 59 | 60 | 1 61 | MCAwLjUwMTk2MDgxNCAwAA 62 | 63 | NO 64 | IBCocoaTouchFramework 65 | 66 | 67 | 68 | 292 69 | {{125, 25}, {57, 57}} 70 | 71 | 72 | 73 | _NS:9 74 | NO 75 | 9 76 | IBCocoaTouchFramework 77 | 0 78 | 0 79 | 80 | 3 81 | MQA 82 | 83 | 84 | 1 85 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 86 | 87 | 88 | 3 89 | MC41AA 90 | 91 | 92 | NSImage 93 | Pause.png 94 | 95 | 96 | NSImage 97 | Play.png 98 | 99 | 100 | 2 101 | 15 102 | 103 | 104 | Helvetica-Bold 105 | 15 106 | 16 107 | 108 | 109 | 110 | {{0, 20}, {320, 460}} 111 | 112 | 113 | 114 | 115 | 3 116 | MC45OAA 117 | 118 | NO 119 | 120 | IBCocoaTouchFramework 121 | 122 | 123 | 124 | 125 | 126 | 127 | view 128 | 129 | 130 | 131 | 7 132 | 133 | 134 | 135 | progressView 136 | 137 | 138 | 139 | 11 140 | 141 | 142 | 143 | progressSlider 144 | 145 | 146 | 147 | 14 148 | 149 | 150 | 151 | playPauseButton 152 | 153 | 154 | 155 | 16 156 | 157 | 158 | 159 | progressSlider: 160 | 161 | 162 | 13 163 | 164 | 17 165 | 166 | 167 | 168 | playPauseButton: 169 | 170 | 171 | 7 172 | 173 | 15 174 | 175 | 176 | 177 | 178 | 179 | 0 180 | 181 | 182 | 183 | 184 | 185 | -1 186 | 187 | 188 | File's Owner 189 | 190 | 191 | -2 192 | 193 | 194 | 195 | 196 | 6 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 8 207 | 208 | 209 | 210 | 211 | 9 212 | 213 | 214 | 215 | 216 | 217 | 13 218 | 219 | 220 | 221 | 222 | 223 | 224 | CEViewController 225 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 226 | UIResponder 227 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 228 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 229 | 230 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 231 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 232 | CERoundProgressView 233 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 234 | 235 | 236 | 237 | 238 | 239 | 17 240 | 241 | 242 | 243 | 244 | CERoundProgressView 245 | UIView 246 | 247 | IBProjectSource 248 | ./Classes/CERoundProgressView.h 249 | 250 | 251 | 252 | CEViewController 253 | UIViewController 254 | 255 | UIButton 256 | UISlider 257 | 258 | 259 | 260 | playPauseButton: 261 | UIButton 262 | 263 | 264 | progressSlider: 265 | UISlider 266 | 267 | 268 | 269 | UIButton 270 | UISlider 271 | CERoundProgressView 272 | 273 | 274 | 275 | playPauseButton 276 | UIButton 277 | 278 | 279 | progressSlider 280 | UISlider 281 | 282 | 283 | progressView 284 | CERoundProgressView 285 | 286 | 287 | 288 | IBProjectSource 289 | ./Classes/CEViewController.h 290 | 291 | 292 | 293 | 294 | 0 295 | IBCocoaTouchFramework 296 | 297 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 298 | 299 | 300 | YES 301 | 3 302 | 303 | {57, 57} 304 | {57, 57} 305 | 306 | 2083 307 | 308 | 309 | -------------------------------------------------------------------------------- /RoundProgress/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /RoundProgress/images/Pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ceroce/CERoundProgressView/8282b0ef0ea82d55a0040336a93a5e7904bf6666/RoundProgress/images/Pause.png -------------------------------------------------------------------------------- /RoundProgress/images/Pause@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ceroce/CERoundProgressView/8282b0ef0ea82d55a0040336a93a5e7904bf6666/RoundProgress/images/Pause@2x.png -------------------------------------------------------------------------------- /RoundProgress/images/Play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ceroce/CERoundProgressView/8282b0ef0ea82d55a0040336a93a5e7904bf6666/RoundProgress/images/Play.png -------------------------------------------------------------------------------- /RoundProgress/images/Play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ceroce/CERoundProgressView/8282b0ef0ea82d55a0040336a93a5e7904bf6666/RoundProgress/images/Play@2x.png -------------------------------------------------------------------------------- /RoundProgress/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RoundProgress 4 | // 5 | // Created by Renaud Pradenc on 25/05/12. 6 | // Copyright (c) 2012 Céroce. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CEAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CEAppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------