├── LBCircleView ├── LBCircleView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── luohuichao.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── luohuichao.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── LBCircleView.xcscheme │ │ └── xcschememanagement.plist ├── LBCircleView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── LBCircleView │ │ ├── LBCircleView.h │ │ └── LBCircleView.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── LBCircleViewTests │ ├── Info.plist │ └── LBCircleViewTests.m └── LBCircleViewUITests │ ├── Info.plist │ └── LBCircleViewUITests.m └── README.md /LBCircleView/LBCircleView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A04DC681C05B98C00D78453 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC671C05B98C00D78453 /* main.m */; }; 11 | 1A04DC6B1C05B98C00D78453 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC6A1C05B98C00D78453 /* AppDelegate.m */; }; 12 | 1A04DC6E1C05B98C00D78453 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC6D1C05B98C00D78453 /* ViewController.m */; }; 13 | 1A04DC711C05B98C00D78453 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A04DC6F1C05B98C00D78453 /* Main.storyboard */; }; 14 | 1A04DC731C05B98C00D78453 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A04DC721C05B98C00D78453 /* Assets.xcassets */; }; 15 | 1A04DC761C05B98C00D78453 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A04DC741C05B98C00D78453 /* LaunchScreen.storyboard */; }; 16 | 1A04DC811C05B98C00D78453 /* LBCircleViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC801C05B98C00D78453 /* LBCircleViewTests.m */; }; 17 | 1A04DC8C1C05B98C00D78453 /* LBCircleViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC8B1C05B98C00D78453 /* LBCircleViewUITests.m */; }; 18 | 1A04DC9C1C05B9BE00D78453 /* LBCircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A04DC9B1C05B9BE00D78453 /* LBCircleView.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 1A04DC7D1C05B98C00D78453 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 1A04DC5B1C05B98C00D78453 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 1A04DC621C05B98C00D78453; 27 | remoteInfo = LBCircleView; 28 | }; 29 | 1A04DC881C05B98C00D78453 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 1A04DC5B1C05B98C00D78453 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 1A04DC621C05B98C00D78453; 34 | remoteInfo = LBCircleView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1A04DC631C05B98C00D78453 /* LBCircleView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LBCircleView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 1A04DC671C05B98C00D78453 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | 1A04DC691C05B98C00D78453 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 1A04DC6A1C05B98C00D78453 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 1A04DC6C1C05B98C00D78453 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | 1A04DC6D1C05B98C00D78453 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | 1A04DC701C05B98C00D78453 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 1A04DC721C05B98C00D78453 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 1A04DC751C05B98C00D78453 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 1A04DC771C05B98C00D78453 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 1A04DC7C1C05B98C00D78453 /* LBCircleViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LBCircleViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 1A04DC801C05B98C00D78453 /* LBCircleViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LBCircleViewTests.m; sourceTree = ""; }; 51 | 1A04DC821C05B98C00D78453 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 1A04DC871C05B98C00D78453 /* LBCircleViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LBCircleViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 1A04DC8B1C05B98C00D78453 /* LBCircleViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LBCircleViewUITests.m; sourceTree = ""; }; 54 | 1A04DC8D1C05B98C00D78453 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 1A04DC9A1C05B9BE00D78453 /* LBCircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBCircleView.h; sourceTree = ""; }; 56 | 1A04DC9B1C05B9BE00D78453 /* LBCircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBCircleView.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 1A04DC601C05B98C00D78453 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 1A04DC791C05B98C00D78453 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 1A04DC841C05B98C00D78453 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 1A04DC5A1C05B98C00D78453 = { 85 | isa = PBXGroup; 86 | children = ( 87 | 1A04DC651C05B98C00D78453 /* LBCircleView */, 88 | 1A04DC7F1C05B98C00D78453 /* LBCircleViewTests */, 89 | 1A04DC8A1C05B98C00D78453 /* LBCircleViewUITests */, 90 | 1A04DC641C05B98C00D78453 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 1A04DC641C05B98C00D78453 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 1A04DC631C05B98C00D78453 /* LBCircleView.app */, 98 | 1A04DC7C1C05B98C00D78453 /* LBCircleViewTests.xctest */, 99 | 1A04DC871C05B98C00D78453 /* LBCircleViewUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 1A04DC651C05B98C00D78453 /* LBCircleView */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 1A04DC991C05B9AC00D78453 /* LBCircleView */, 108 | 1A04DC691C05B98C00D78453 /* AppDelegate.h */, 109 | 1A04DC6A1C05B98C00D78453 /* AppDelegate.m */, 110 | 1A04DC6C1C05B98C00D78453 /* ViewController.h */, 111 | 1A04DC6D1C05B98C00D78453 /* ViewController.m */, 112 | 1A04DC6F1C05B98C00D78453 /* Main.storyboard */, 113 | 1A04DC721C05B98C00D78453 /* Assets.xcassets */, 114 | 1A04DC741C05B98C00D78453 /* LaunchScreen.storyboard */, 115 | 1A04DC771C05B98C00D78453 /* Info.plist */, 116 | 1A04DC661C05B98C00D78453 /* Supporting Files */, 117 | ); 118 | path = LBCircleView; 119 | sourceTree = ""; 120 | }; 121 | 1A04DC661C05B98C00D78453 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 1A04DC671C05B98C00D78453 /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | 1A04DC7F1C05B98C00D78453 /* LBCircleViewTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 1A04DC801C05B98C00D78453 /* LBCircleViewTests.m */, 133 | 1A04DC821C05B98C00D78453 /* Info.plist */, 134 | ); 135 | path = LBCircleViewTests; 136 | sourceTree = ""; 137 | }; 138 | 1A04DC8A1C05B98C00D78453 /* LBCircleViewUITests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 1A04DC8B1C05B98C00D78453 /* LBCircleViewUITests.m */, 142 | 1A04DC8D1C05B98C00D78453 /* Info.plist */, 143 | ); 144 | path = LBCircleViewUITests; 145 | sourceTree = ""; 146 | }; 147 | 1A04DC991C05B9AC00D78453 /* LBCircleView */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 1A04DC9A1C05B9BE00D78453 /* LBCircleView.h */, 151 | 1A04DC9B1C05B9BE00D78453 /* LBCircleView.m */, 152 | ); 153 | path = LBCircleView; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 1A04DC621C05B98C00D78453 /* LBCircleView */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 1A04DC901C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleView" */; 162 | buildPhases = ( 163 | 1A04DC5F1C05B98C00D78453 /* Sources */, 164 | 1A04DC601C05B98C00D78453 /* Frameworks */, 165 | 1A04DC611C05B98C00D78453 /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = LBCircleView; 172 | productName = LBCircleView; 173 | productReference = 1A04DC631C05B98C00D78453 /* LBCircleView.app */; 174 | productType = "com.apple.product-type.application"; 175 | }; 176 | 1A04DC7B1C05B98C00D78453 /* LBCircleViewTests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1A04DC931C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleViewTests" */; 179 | buildPhases = ( 180 | 1A04DC781C05B98C00D78453 /* Sources */, 181 | 1A04DC791C05B98C00D78453 /* Frameworks */, 182 | 1A04DC7A1C05B98C00D78453 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 1A04DC7E1C05B98C00D78453 /* PBXTargetDependency */, 188 | ); 189 | name = LBCircleViewTests; 190 | productName = LBCircleViewTests; 191 | productReference = 1A04DC7C1C05B98C00D78453 /* LBCircleViewTests.xctest */; 192 | productType = "com.apple.product-type.bundle.unit-test"; 193 | }; 194 | 1A04DC861C05B98C00D78453 /* LBCircleViewUITests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 1A04DC961C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleViewUITests" */; 197 | buildPhases = ( 198 | 1A04DC831C05B98C00D78453 /* Sources */, 199 | 1A04DC841C05B98C00D78453 /* Frameworks */, 200 | 1A04DC851C05B98C00D78453 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 1A04DC891C05B98C00D78453 /* PBXTargetDependency */, 206 | ); 207 | name = LBCircleViewUITests; 208 | productName = LBCircleViewUITests; 209 | productReference = 1A04DC871C05B98C00D78453 /* LBCircleViewUITests.xctest */; 210 | productType = "com.apple.product-type.bundle.ui-testing"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 1A04DC5B1C05B98C00D78453 /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0710; 219 | ORGANIZATIONNAME = luobbe; 220 | TargetAttributes = { 221 | 1A04DC621C05B98C00D78453 = { 222 | CreatedOnToolsVersion = 7.1.1; 223 | }; 224 | 1A04DC7B1C05B98C00D78453 = { 225 | CreatedOnToolsVersion = 7.1.1; 226 | TestTargetID = 1A04DC621C05B98C00D78453; 227 | }; 228 | 1A04DC861C05B98C00D78453 = { 229 | CreatedOnToolsVersion = 7.1.1; 230 | TestTargetID = 1A04DC621C05B98C00D78453; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = 1A04DC5E1C05B98C00D78453 /* Build configuration list for PBXProject "LBCircleView" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | Base, 241 | ); 242 | mainGroup = 1A04DC5A1C05B98C00D78453; 243 | productRefGroup = 1A04DC641C05B98C00D78453 /* Products */; 244 | projectDirPath = ""; 245 | projectRoot = ""; 246 | targets = ( 247 | 1A04DC621C05B98C00D78453 /* LBCircleView */, 248 | 1A04DC7B1C05B98C00D78453 /* LBCircleViewTests */, 249 | 1A04DC861C05B98C00D78453 /* LBCircleViewUITests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | 1A04DC611C05B98C00D78453 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 1A04DC761C05B98C00D78453 /* LaunchScreen.storyboard in Resources */, 260 | 1A04DC731C05B98C00D78453 /* Assets.xcassets in Resources */, 261 | 1A04DC711C05B98C00D78453 /* Main.storyboard in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | 1A04DC7A1C05B98C00D78453 /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | 1A04DC851C05B98C00D78453 /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXResourcesBuildPhase section */ 280 | 281 | /* Begin PBXSourcesBuildPhase section */ 282 | 1A04DC5F1C05B98C00D78453 /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 1A04DC9C1C05B9BE00D78453 /* LBCircleView.m in Sources */, 287 | 1A04DC6E1C05B98C00D78453 /* ViewController.m in Sources */, 288 | 1A04DC6B1C05B98C00D78453 /* AppDelegate.m in Sources */, 289 | 1A04DC681C05B98C00D78453 /* main.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 1A04DC781C05B98C00D78453 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 1A04DC811C05B98C00D78453 /* LBCircleViewTests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 1A04DC831C05B98C00D78453 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 1A04DC8C1C05B98C00D78453 /* LBCircleViewUITests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 1A04DC7E1C05B98C00D78453 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 1A04DC621C05B98C00D78453 /* LBCircleView */; 315 | targetProxy = 1A04DC7D1C05B98C00D78453 /* PBXContainerItemProxy */; 316 | }; 317 | 1A04DC891C05B98C00D78453 /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 1A04DC621C05B98C00D78453 /* LBCircleView */; 320 | targetProxy = 1A04DC881C05B98C00D78453 /* PBXContainerItemProxy */; 321 | }; 322 | /* End PBXTargetDependency section */ 323 | 324 | /* Begin PBXVariantGroup section */ 325 | 1A04DC6F1C05B98C00D78453 /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 1A04DC701C05B98C00D78453 /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | 1A04DC741C05B98C00D78453 /* LaunchScreen.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 1A04DC751C05B98C00D78453 /* Base */, 337 | ); 338 | name = LaunchScreen.storyboard; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 1A04DC8E1C05B98C00D78453 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | }; 385 | name = Debug; 386 | }; 387 | 1A04DC8F1C05B98C00D78453 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 1A04DC911C05B98C00D78453 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 428 | INFOPLIST_FILE = LBCircleView/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleView; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | }; 433 | name = Debug; 434 | }; 435 | 1A04DC921C05B98C00D78453 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | INFOPLIST_FILE = LBCircleView/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleView; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | }; 444 | name = Release; 445 | }; 446 | 1A04DC941C05B98C00D78453 /* Debug */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | BUNDLE_LOADER = "$(TEST_HOST)"; 450 | INFOPLIST_FILE = LBCircleViewTests/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleViewTests; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBCircleView.app/LBCircleView"; 455 | }; 456 | name = Debug; 457 | }; 458 | 1A04DC951C05B98C00D78453 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | BUNDLE_LOADER = "$(TEST_HOST)"; 462 | INFOPLIST_FILE = LBCircleViewTests/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 464 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleViewTests; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBCircleView.app/LBCircleView"; 467 | }; 468 | name = Release; 469 | }; 470 | 1A04DC971C05B98C00D78453 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | INFOPLIST_FILE = LBCircleViewUITests/Info.plist; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleViewUITests; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_TARGET_NAME = LBCircleView; 478 | USES_XCTRUNNER = YES; 479 | }; 480 | name = Debug; 481 | }; 482 | 1A04DC981C05B98C00D78453 /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | INFOPLIST_FILE = LBCircleViewUITests/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBCircleViewUITests; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | TEST_TARGET_NAME = LBCircleView; 490 | USES_XCTRUNNER = YES; 491 | }; 492 | name = Release; 493 | }; 494 | /* End XCBuildConfiguration section */ 495 | 496 | /* Begin XCConfigurationList section */ 497 | 1A04DC5E1C05B98C00D78453 /* Build configuration list for PBXProject "LBCircleView" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 1A04DC8E1C05B98C00D78453 /* Debug */, 501 | 1A04DC8F1C05B98C00D78453 /* Release */, 502 | ); 503 | defaultConfigurationIsVisible = 0; 504 | defaultConfigurationName = Release; 505 | }; 506 | 1A04DC901C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleView" */ = { 507 | isa = XCConfigurationList; 508 | buildConfigurations = ( 509 | 1A04DC911C05B98C00D78453 /* Debug */, 510 | 1A04DC921C05B98C00D78453 /* Release */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | }; 514 | 1A04DC931C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleViewTests" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 1A04DC941C05B98C00D78453 /* Debug */, 518 | 1A04DC951C05B98C00D78453 /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | }; 522 | 1A04DC961C05B98C00D78453 /* Build configuration list for PBXNativeTarget "LBCircleViewUITests" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 1A04DC971C05B98C00D78453 /* Debug */, 526 | 1A04DC981C05B98C00D78453 /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | }; 530 | /* End XCConfigurationList section */ 531 | }; 532 | rootObject = 1A04DC5B1C05B98C00D78453 /* Project object */; 533 | } 534 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView.xcodeproj/project.xcworkspace/xcuserdata/luohuichao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lovels/LBCircleView/e1bdc1ee2f1b5cb287f9abcb50c71714660040c6/LBCircleView/LBCircleView.xcodeproj/project.xcworkspace/xcuserdata/luohuichao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LBCircleView/LBCircleView.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/LBCircleView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LBCircleView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1A04DC621C05B98C00D78453 16 | 17 | primary 18 | 19 | 20 | 1A04DC7B1C05B98C00D78453 21 | 22 | primary 23 | 24 | 25 | 1A04DC861C05B98C00D78453 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. 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 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. 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 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/LBCircleView/LBCircleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBCircleView.h 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //环形画笔的宽度 12 | #define ChartWidth 3 13 | //环形开始的位置 14 | #define ChartStart M_PI*5/6 15 | //环形结束的位置 16 | #define ChartEnd M_PI/6 17 | 18 | #define BackGroundColor [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5] //环形背景默认颜色 19 | #define ProgressColor [UIColor orangeColor] // 20 | 21 | @interface LBCircleView : UIView 22 | 23 | @property (nonatomic, strong) UIColor *percentColor; 24 | 25 | /**set before call setProgress: or useless Default is ProgressColor */ 26 | @property (nonatomic, strong) UIColor *circleColor; 27 | 28 | - (void)setProgress:(double)value animated:(BOOL)animate; 29 | 30 | @end 31 | 32 | @interface UILabel (LBAnimation) 33 | 34 | //数字滚动 35 | - (void)scrollNumFromValue:(CGFloat)fromValue toValue:(CGFloat)toValue during:(CGFloat)time; 36 | 37 | @end -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/LBCircleView/LBCircleView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBCircleView.m 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "LBCircleView.h" 10 | 11 | @interface LBCircleView() 12 | { 13 | CAShapeLayer *circleLayer; 14 | CAShapeLayer *bgCircleLayer; 15 | CGFloat radius; //环形进度的半径 16 | CGPoint center; //环形中心点 17 | double progress; //进度的比例 18 | BOOL animated; 19 | CGFloat radian; 20 | } 21 | 22 | @property (nonatomic, strong) UILabel *percentLB; 23 | @property (nonatomic, strong) UILabel *progressLB; 24 | @property (nonatomic, strong) UILabel *subTitleLB; 25 | 26 | @end 27 | 28 | @implementation LBCircleView 29 | 30 | - (instancetype)initWithFrame:(CGRect)frame 31 | { 32 | self = [super initWithFrame:frame]; 33 | if (self) { 34 | // Initialization code 35 | self.backgroundColor = [UIColor clearColor]; 36 | self.layer.masksToBounds = YES; 37 | _circleColor = ProgressColor; 38 | [self addSubview:self.percentLB]; 39 | //计算最大的percentLB尺寸 40 | self.percentLB.text = [NSString stringWithFormat:@"%.0f%%",1.0*100]; 41 | [self.percentLB sizeToFit]; 42 | self.percentLB.text = @"0%"; 43 | // 44 | [self configuration]; 45 | // 46 | [self initBackgroundView]; 47 | } 48 | return self; 49 | } 50 | /* 51 | // Only override drawRect: if you perform custom drawing. 52 | // An empty implementation adversely affects performance during animation. 53 | - (void)drawRect:(CGRect)rect { 54 | // Drawing code 55 | } 56 | */ 57 | 58 | - (void)setProgress:(double)value animated:(BOOL)animate 59 | { 60 | NSAssert([self validateValue:value], @"value是包含0、1之间的数值"); 61 | progress = value; 62 | animated = animate; 63 | radian = value * (2* M_PI - fabs(ChartStart - ChartEnd)); 64 | self.percentLB.text = [NSString stringWithFormat:@"%.0f%%",progress*100]; 65 | self.percentLB.center = [self percentCenter]; 66 | //圆环 67 | [self creatCircleLayer]; 68 | } 69 | 70 | //检查传过来的百分比 是否合法 71 | - (BOOL)validateValue:(double)value 72 | { 73 | if (value>= 0 && value <=1) 74 | return YES; 75 | 76 | return NO; 77 | } 78 | 79 | //设置 80 | - (void)configuration 81 | { 82 | //半径 83 | radius = CGRectGetWidth(self.frame)/2.0 - CGRectGetWidth(self.percentLB.frame); 84 | //中心点 85 | center = CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetWidth(self.frame)/2.0); 86 | } 87 | 88 | //创建背景 89 | - (void)initBackgroundView 90 | { 91 | UIBezierPath *path = [UIBezierPath bezierPath]; 92 | [path addArcWithCenter:center radius:radius startAngle:ChartStart endAngle:ChartEnd clockwise:YES]; 93 | bgCircleLayer = [CAShapeLayer layer]; 94 | bgCircleLayer.path = path.CGPath; 95 | bgCircleLayer.fillColor = [UIColor clearColor].CGColor; 96 | bgCircleLayer.strokeColor = BackGroundColor.CGColor; 97 | bgCircleLayer.lineWidth = ChartWidth; 98 | [self.layer addSublayer:bgCircleLayer]; 99 | } 100 | 101 | //进度圆环 102 | - (void)creatCircleLayer 103 | { 104 | if (circleLayer != nil) { 105 | [circleLayer removeFromSuperlayer]; 106 | } 107 | UIBezierPath *path = [UIBezierPath bezierPath]; 108 | [path addArcWithCenter:center radius:radius startAngle:ChartStart endAngle:ChartStart + radian clockwise:YES]; 109 | circleLayer = [CAShapeLayer layer]; 110 | circleLayer.path = path.CGPath; 111 | circleLayer.fillColor = [UIColor clearColor].CGColor; 112 | circleLayer.strokeColor = _circleColor.CGColor; 113 | circleLayer.lineWidth = ChartWidth-0.3; 114 | [self.layer addSublayer:circleLayer]; 115 | if (animated) { 116 | [self circleAnimation:circleLayer]; 117 | [self percentAnimate:self.percentLB.layer]; 118 | [self.percentLB scrollNumFromValue:0 toValue:progress*100 during:2]; 119 | } 120 | } 121 | 122 | #pragma mark ----animations 123 | - (void)circleAnimation:(CALayer*)layer 124 | { 125 | CABasicAnimation *basic=[CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 126 | basic.duration = 2; 127 | basic.fromValue = @(0); 128 | basic.toValue = @(1); 129 | [layer addAnimation:basic forKey:@"StrokeEndKey"]; 130 | } 131 | 132 | - (void)percentAnimate:(CALayer*)layer 133 | { 134 | CGFloat R = CGRectGetWidth(self.frame)/2.0-CGRectGetWidth(self.percentLB.frame)/2.0; 135 | CGPoint centerP = CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetWidth(self.frame)/2.0); 136 | 137 | UIBezierPath *path=[UIBezierPath bezierPath]; 138 | //这段圆弧的中心,半径,开始角度,结束角度,是否顺时针方向。 139 | [path addArcWithCenter:centerP radius:R startAngle:ChartStart endAngle:ChartStart + radian clockwise:YES]; 140 | CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 141 | animation.duration = 2.0; 142 | animation.path = path.CGPath; 143 | animation.calculationMode = kCAAnimationPaced; 144 | [layer addAnimation:animation forKey:@"PercentPosition"]; 145 | 146 | } 147 | 148 | //百分比的最终的中心位置 149 | - (CGPoint)percentCenter 150 | { 151 | CGFloat R = CGRectGetWidth(self.frame)/2.0-CGRectGetWidth(self.percentLB.frame)/2.0; 152 | CGPoint centerP = CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetWidth(self.frame)/2.0); 153 | CGFloat x = centerP.x + R * cos(radian + ChartStart); 154 | CGFloat y = centerP.y + R * sin(radian + ChartStart); 155 | return CGPointMake(x, y); 156 | } 157 | 158 | - (UILabel *)percentLB 159 | { 160 | if (_percentLB == nil) { 161 | // 162 | _percentLB = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 20)]; 163 | _percentLB.font = [UIFont systemFontOfSize:10]; 164 | _percentLB.backgroundColor = [UIColor clearColor]; 165 | _percentLB.textAlignment = NSTextAlignmentCenter; 166 | } 167 | return _percentLB; 168 | } 169 | 170 | - (void)setPercentColor:(UIColor *)percentColor 171 | { 172 | self.percentLB.textColor = percentColor; 173 | } 174 | 175 | @end 176 | 177 | @implementation UILabel (LBAnimation) 178 | 179 | - (void)scrollNumFromValue:(CGFloat)fromValue toValue:(CGFloat)toValue during:(CGFloat)time 180 | { 181 | //默认60次动画 182 | self.text = [NSString stringWithFormat:@"%.0f%%",fromValue]; 183 | __block int count = 30; //循环的次数 184 | CGFloat increase = (toValue - fromValue)/count; 185 | CGFloat perTime = time * 1.0 / count; 186 | 187 | __block float currentNum = fromValue; 188 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 189 | dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); 190 | dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),perTime*NSEC_PER_SEC, 0); 191 | dispatch_source_set_event_handler(_timer, ^{ 192 | //计算每次递增 193 | if(count <= 0){ 194 | dispatch_source_cancel(_timer); 195 | dispatch_async(dispatch_get_main_queue(), ^{ 196 | self.text = [NSString stringWithFormat:@"%.0f%%",toValue]; 197 | }); 198 | }else{ 199 | dispatch_async(dispatch_get_main_queue(), ^{ 200 | if (currentNum >= toValue) { 201 | count = 0; 202 | }else{ 203 | currentNum = currentNum + increase; 204 | self.text = [NSString stringWithFormat:@"%.0f%%",currentNum]; 205 | } 206 | }); 207 | count --; 208 | } 209 | }); 210 | dispatch_resume(_timer); 211 | 212 | } 213 | 214 | @end 215 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LBCircleView.h" 11 | 12 | @interface ViewController () 13 | { 14 | LBCircleView *circleView; 15 | } 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view, typically from a nib. 24 | circleView = [[LBCircleView alloc] initWithFrame:CGRectMake(0, 0, 250, 250)]; 25 | circleView.center = self.view.center; 26 | circleView.backgroundColor = [UIColor colorWithRed:255.0/255 green:157.0/255 blue:182.0/255 alpha:1.0]; 27 | [self.view addSubview:circleView]; 28 | circleView.percentColor = [UIColor colorWithRed:76.0/255 green:15.0/255 blue:77.0/255 alpha:1.0]; 29 | 30 | [circleView setProgress:0.5 animated:YES]; 31 | 32 | } 33 | 34 | - (void)didReceiveMemoryWarning { 35 | [super didReceiveMemoryWarning]; 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 40 | { 41 | [circleView setProgress:(arc4random()%100/100.0) animated:YES]; 42 | 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LBCircleView 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. 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 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleViewTests/LBCircleViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBCircleViewTests.m 3 | // LBCircleViewTests 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBCircleViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LBCircleViewTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LBCircleView/LBCircleViewUITests/LBCircleViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBCircleViewUITests.m 3 | // LBCircleViewUITests 4 | // 5 | // Created by luobbe on 15/11/23. 6 | // Copyright © 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBCircleViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LBCircleViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## LBCircleView 2 | 3 | ### 效果 4 | 5 | ![image](http://ww1.sinaimg.cn/large/9f1201f5jw1eydkouyyrog208m0e840o.gif) 6 | 7 | ### 用法 8 | 9 | ``` 10 | LBCircleView *circleView = [[LBCircleView alloc] initWithFrame:CGRectMake(0, 0, 250, 250)]; 11 | circleView.center = self.view.center; 12 | circleView.backgroundColor = [UIColor colorWithRed:255.0/255 green:157.0/255 blue:182.0/255 alpha:1.0]; 13 | [self.view addSubview:circleView]; 14 | circleView.percentColor = [UIColor colorWithRed:76.0/255 green:15.0/255 blue:77.0/255 alpha:1.0]; 15 | [circleView setProgress:0.5 animated:YES]; 16 | ``` --------------------------------------------------------------------------------