├── .gitignore ├── FDActivityIndicatorView.podspec ├── FDActivityIndicatorView ├── FDActivityIndicatorView.h ├── FDActivityIndicatorView.m └── iOS-Custom-Circle-ActivityIn.textClipping ├── FDActivityIndicatorViewDemo ├── .DS_Store ├── FDActivityIndicatorViewDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── FDActivityIndicatorViewDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── FDActivityIndicatorView │ │ ├── FDActivityIndicatorView.h │ │ └── FDActivityIndicatorView.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── FDActivityIndicatorViewDemoTests │ ├── FDActivityIndicatorViewDemoTests.m │ └── Info.plist ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.DS_Store 19 | *.xcuserstate 20 | 21 | # CocoaPods 22 | # 23 | # We recommend against adding the Pods directory to your .gitignore. However 24 | # you should judge for yourself, the pros and cons are mentioned at: 25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 26 | # 27 | #Pods/ 28 | -------------------------------------------------------------------------------- /FDActivityIndicatorView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint FDActivityIndicaotrView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "FDActivityIndicatorView" 19 | s.version = "0.0.1" 20 | s.summary = "A custom ActivityIndicatorView used in iOS." 21 | 22 | s.description = <<-DESC 23 | FDActivityIndicatorView is a activity indicatorview which shows a circle rotating, it is similar to wechat login activity indicator view. Also it supports to set the size accroding to it's frame and set the color of the circle. 24 | 25 | * Think: Why did you write this? What is the focus? What does it do? 26 | * CocoaPods will be using this to generate tags, and improve search results. 27 | * Try to keep it short, snappy and to the point. 28 | * Finally, don't worry about the indent, CocoaPods strips it! 29 | DESC 30 | 31 | s.homepage = "https://github.com/fergusding/iOS-Custom-Circle-ActivityIndicatorView" 32 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 33 | 34 | 35 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 36 | # 37 | # Licensing your code is important. See http://choosealicense.com for more info. 38 | # CocoaPods will detect a license file if there is a named LICENSE* 39 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 40 | # 41 | 42 | s.license = "MIT" 43 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 44 | 45 | 46 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 47 | # 48 | # Specify the authors of the library, with email addresses. Email addresses 49 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 50 | # accepts just a name if you'd rather not provide an email address. 51 | # 52 | # Specify a social_media_url where others can refer to, for example a twitter 53 | # profile URL. 54 | # 55 | 56 | s.author = { "Fergus Ding" => "fergusding@augmentum.com.cn" } 57 | # Or just: s.author = "Fergus Ding" 58 | # s.authors = { "Fergus Ding" => "fergusding@augmentum.com.cn" } 59 | # s.social_media_url = "http://twitter.com/Fergus Ding" 60 | 61 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 62 | # 63 | # If this Pod runs only on iOS or OS X, then specify the platform and 64 | # the deployment target. You can optionally include the target after the platform. 65 | # 66 | 67 | # s.platform = :ios 68 | s.platform = :ios, "7.0" 69 | 70 | # When using multiple platforms 71 | # s.ios.deployment_target = "5.0" 72 | # s.osx.deployment_target = "10.7" 73 | 74 | 75 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 76 | # 77 | # Specify the location from where the source should be retrieved. 78 | # Supports git, hg, bzr, svn and HTTP. 79 | # 80 | 81 | s.source = { :git => "https://github.com/fergusding/iOS-Custom-Circle-ActivityIndicatorView.git", :tag => "0.0.1" } 82 | 83 | 84 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 85 | # 86 | # CocoaPods is smart about how it includes source code. For source files 87 | # giving a folder will include any h, m, mm, c & cpp files. For header 88 | # files it will include any header in the folder. 89 | # Not including the public_header_files will make all headers public. 90 | # 91 | 92 | s.source_files = "FDActivityIndicatorView/*" 93 | # s.exclude_files = "Classes/Exclude" 94 | 95 | # s.public_header_files = "Classes/**/*.h" 96 | 97 | 98 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 99 | # 100 | # A list of resources included with the Pod. These are copied into the 101 | # target bundle with a build phase script. Anything else will be cleaned. 102 | # You can preserve files from being cleaned, please don't preserve 103 | # non-essential files like tests, examples and documentation. 104 | # 105 | 106 | # s.resource = "icon.png" 107 | # s.resources = "Resources/*.png" 108 | 109 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 110 | 111 | 112 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 113 | # 114 | # Link your library with frameworks, or libraries. Libraries do not include 115 | # the lib prefix of their name. 116 | # 117 | 118 | # s.framework = "SomeFramework" 119 | s.frameworks = "Foundation", "UIKit" 120 | 121 | # s.library = "iconv" 122 | # s.libraries = "iconv", "xml2" 123 | 124 | 125 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 126 | # 127 | # If your library depends on compiler flags you can set them in the xcconfig hash 128 | # where they will only apply to your library. If you depend on other Podspecs 129 | # you can include multiple dependencies to ensure it works. 130 | 131 | s.requires_arc = true 132 | 133 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 134 | # s.dependency "JSONKit", "~> 1.4" 135 | 136 | end 137 | -------------------------------------------------------------------------------- /FDActivityIndicatorView/FDActivityIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDActivityIndicatorView.h 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FDActivityIndicatorView : UIView 12 | 13 | @property (strong, nonatomic) UIColor *color; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FDActivityIndicatorView/FDActivityIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FDActivityIndicatorView.m 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import "FDActivityIndicatorView.h" 10 | 11 | @implementation FDActivityIndicatorView 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | if (self = [super initWithFrame:frame]) { 15 | self.backgroundColor = [UIColor clearColor]; 16 | self.layer.masksToBounds = YES; 17 | self.layer.cornerRadius = self.frame.size.width / 2; 18 | 19 | [self addAnimation]; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)drawRect:(CGRect)rect { 25 | CGContextRef context = UIGraphicsGetCurrentContext(); 26 | for (int i = 0; i < 360; i++) { 27 | CGFloat beginAngle = M_PI * 2 / 360 * i; 28 | CGFloat toAngle = beginAngle + M_PI * 2 / 360; 29 | CGFloat alpha = 1.0 / 360 * (i + 1); 30 | [self drawCircleWithContext:context beginAngle:beginAngle toAngle:toAngle color:_color alpha:alpha]; 31 | } 32 | } 33 | 34 | // Draw the circle indicator view 35 | - (void)drawCircleWithContext:(CGContextRef)context beginAngle:(CGFloat)beginAngle toAngle:(CGFloat) toAngle color:(UIColor *)color alpha:(CGFloat)alpha { 36 | CGContextSaveGState(context); 37 | CGContextBeginPath(context); 38 | CGFloat r, g, b; 39 | [color getRed:&r green:&g blue:&b alpha:nil]; 40 | CGContextSetRGBStrokeColor(context, r, g, b, alpha); 41 | CGContextSetLineWidth(context, 5.0); 42 | CGContextAddArc(context, self.frame.size.width / 2, self.frame.size.height / 2, self.frame.size.width / 2, beginAngle, toAngle, 0); 43 | CGContextDrawPath(context, kCGPathStroke); 44 | } 45 | 46 | - (void)addAnimation { 47 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 48 | animation.removedOnCompletion = NO; 49 | animation.fillMode = kCAFillModeForwards; 50 | animation.fromValue = @(0); 51 | animation.toValue = @(M_PI * 2); 52 | animation.duration = 1.f; 53 | animation.repeatCount = INT_MAX; 54 | 55 | [self.layer addAnimation:animation forKey:@"rotate"]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FDActivityIndicatorView/iOS-Custom-Circle-ActivityIn.textClipping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fergusding/iOS-Custom-Circle-ActivityIndicatorView/20e8c7e181e9fdfdc07fd89182f9c1860be63e8d/FDActivityIndicatorView/iOS-Custom-Circle-ActivityIn.textClipping -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fergusding/iOS-Custom-Circle-ActivityIndicatorView/20e8c7e181e9fdfdc07fd89182f9c1860be63e8d/FDActivityIndicatorViewDemo/.DS_Store -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EA59FD811B1558ED0006024F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EA59FD801B1558ED0006024F /* main.m */; }; 11 | EA59FD841B1558ED0006024F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EA59FD831B1558ED0006024F /* AppDelegate.m */; }; 12 | EA59FD871B1558ED0006024F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA59FD861B1558ED0006024F /* ViewController.m */; }; 13 | EA59FD8A1B1558EE0006024F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA59FD881B1558EE0006024F /* Main.storyboard */; }; 14 | EA59FD8C1B1558EE0006024F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EA59FD8B1B1558EE0006024F /* Images.xcassets */; }; 15 | EA59FD8F1B1558EE0006024F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EA59FD8D1B1558EE0006024F /* LaunchScreen.xib */; }; 16 | EA59FD9B1B1558EE0006024F /* FDActivityIndicatorViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EA59FD9A1B1558EE0006024F /* FDActivityIndicatorViewDemoTests.m */; }; 17 | EA59FDA71B1559410006024F /* FDActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = EA59FDA61B1559410006024F /* FDActivityIndicatorView.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | EA59FD951B1558EE0006024F /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = EA59FD731B1558ED0006024F /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = EA59FD7A1B1558ED0006024F; 26 | remoteInfo = FDActivityIndicatorViewDemo; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | EA59FD7B1B1558ED0006024F /* FDActivityIndicatorViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FDActivityIndicatorViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | EA59FD7F1B1558ED0006024F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | EA59FD801B1558ED0006024F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | EA59FD821B1558ED0006024F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | EA59FD831B1558ED0006024F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | EA59FD851B1558ED0006024F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 37 | EA59FD861B1558ED0006024F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 38 | EA59FD891B1558EE0006024F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | EA59FD8B1B1558EE0006024F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | EA59FD8E1B1558EE0006024F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | EA59FD941B1558EE0006024F /* FDActivityIndicatorViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FDActivityIndicatorViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | EA59FD991B1558EE0006024F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | EA59FD9A1B1558EE0006024F /* FDActivityIndicatorViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FDActivityIndicatorViewDemoTests.m; sourceTree = ""; }; 44 | EA59FDA51B1559410006024F /* FDActivityIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FDActivityIndicatorView.h; path = FDActivityIndicatorView/FDActivityIndicatorView.h; sourceTree = ""; }; 45 | EA59FDA61B1559410006024F /* FDActivityIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FDActivityIndicatorView.m; path = FDActivityIndicatorView/FDActivityIndicatorView.m; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | EA59FD781B1558ED0006024F /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | EA59FD911B1558EE0006024F /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | EA59FD721B1558ED0006024F = { 67 | isa = PBXGroup; 68 | children = ( 69 | EA59FD7D1B1558ED0006024F /* FDActivityIndicatorViewDemo */, 70 | EA59FD971B1558EE0006024F /* FDActivityIndicatorViewDemoTests */, 71 | EA59FD7C1B1558ED0006024F /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | EA59FD7C1B1558ED0006024F /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | EA59FD7B1B1558ED0006024F /* FDActivityIndicatorViewDemo.app */, 79 | EA59FD941B1558EE0006024F /* FDActivityIndicatorViewDemoTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | EA59FD7D1B1558ED0006024F /* FDActivityIndicatorViewDemo */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | EA59FDA41B1558FE0006024F /* FDActivityIndicatorView */, 88 | EA59FD821B1558ED0006024F /* AppDelegate.h */, 89 | EA59FD831B1558ED0006024F /* AppDelegate.m */, 90 | EA59FD851B1558ED0006024F /* ViewController.h */, 91 | EA59FD861B1558ED0006024F /* ViewController.m */, 92 | EA59FD881B1558EE0006024F /* Main.storyboard */, 93 | EA59FD8B1B1558EE0006024F /* Images.xcassets */, 94 | EA59FD8D1B1558EE0006024F /* LaunchScreen.xib */, 95 | EA59FD7E1B1558ED0006024F /* Supporting Files */, 96 | ); 97 | path = FDActivityIndicatorViewDemo; 98 | sourceTree = ""; 99 | }; 100 | EA59FD7E1B1558ED0006024F /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | EA59FD7F1B1558ED0006024F /* Info.plist */, 104 | EA59FD801B1558ED0006024F /* main.m */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | EA59FD971B1558EE0006024F /* FDActivityIndicatorViewDemoTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | EA59FD9A1B1558EE0006024F /* FDActivityIndicatorViewDemoTests.m */, 113 | EA59FD981B1558EE0006024F /* Supporting Files */, 114 | ); 115 | path = FDActivityIndicatorViewDemoTests; 116 | sourceTree = ""; 117 | }; 118 | EA59FD981B1558EE0006024F /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | EA59FD991B1558EE0006024F /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | EA59FDA41B1558FE0006024F /* FDActivityIndicatorView */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | EA59FDA51B1559410006024F /* FDActivityIndicatorView.h */, 130 | EA59FDA61B1559410006024F /* FDActivityIndicatorView.m */, 131 | ); 132 | name = FDActivityIndicatorView; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | EA59FD7A1B1558ED0006024F /* FDActivityIndicatorViewDemo */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = EA59FD9E1B1558EE0006024F /* Build configuration list for PBXNativeTarget "FDActivityIndicatorViewDemo" */; 141 | buildPhases = ( 142 | EA59FD771B1558ED0006024F /* Sources */, 143 | EA59FD781B1558ED0006024F /* Frameworks */, 144 | EA59FD791B1558ED0006024F /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = FDActivityIndicatorViewDemo; 151 | productName = FDActivityIndicatorViewDemo; 152 | productReference = EA59FD7B1B1558ED0006024F /* FDActivityIndicatorViewDemo.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | EA59FD931B1558EE0006024F /* FDActivityIndicatorViewDemoTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = EA59FDA11B1558EE0006024F /* Build configuration list for PBXNativeTarget "FDActivityIndicatorViewDemoTests" */; 158 | buildPhases = ( 159 | EA59FD901B1558EE0006024F /* Sources */, 160 | EA59FD911B1558EE0006024F /* Frameworks */, 161 | EA59FD921B1558EE0006024F /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | EA59FD961B1558EE0006024F /* PBXTargetDependency */, 167 | ); 168 | name = FDActivityIndicatorViewDemoTests; 169 | productName = FDActivityIndicatorViewDemoTests; 170 | productReference = EA59FD941B1558EE0006024F /* FDActivityIndicatorViewDemoTests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | EA59FD731B1558ED0006024F /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0630; 180 | ORGANIZATIONNAME = fergusding; 181 | TargetAttributes = { 182 | EA59FD7A1B1558ED0006024F = { 183 | CreatedOnToolsVersion = 6.3.1; 184 | }; 185 | EA59FD931B1558EE0006024F = { 186 | CreatedOnToolsVersion = 6.3.1; 187 | TestTargetID = EA59FD7A1B1558ED0006024F; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = EA59FD761B1558ED0006024F /* Build configuration list for PBXProject "FDActivityIndicatorViewDemo" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = EA59FD721B1558ED0006024F; 200 | productRefGroup = EA59FD7C1B1558ED0006024F /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | EA59FD7A1B1558ED0006024F /* FDActivityIndicatorViewDemo */, 205 | EA59FD931B1558EE0006024F /* FDActivityIndicatorViewDemoTests */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | EA59FD791B1558ED0006024F /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | EA59FD8A1B1558EE0006024F /* Main.storyboard in Resources */, 216 | EA59FD8F1B1558EE0006024F /* LaunchScreen.xib in Resources */, 217 | EA59FD8C1B1558EE0006024F /* Images.xcassets in Resources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | EA59FD921B1558EE0006024F /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXResourcesBuildPhase section */ 229 | 230 | /* Begin PBXSourcesBuildPhase section */ 231 | EA59FD771B1558ED0006024F /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | EA59FD871B1558ED0006024F /* ViewController.m in Sources */, 236 | EA59FD841B1558ED0006024F /* AppDelegate.m in Sources */, 237 | EA59FD811B1558ED0006024F /* main.m in Sources */, 238 | EA59FDA71B1559410006024F /* FDActivityIndicatorView.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | EA59FD901B1558EE0006024F /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | EA59FD9B1B1558EE0006024F /* FDActivityIndicatorViewDemoTests.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | EA59FD961B1558EE0006024F /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = EA59FD7A1B1558ED0006024F /* FDActivityIndicatorViewDemo */; 256 | targetProxy = EA59FD951B1558EE0006024F /* PBXContainerItemProxy */; 257 | }; 258 | /* End PBXTargetDependency section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | EA59FD881B1558EE0006024F /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | EA59FD891B1558EE0006024F /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | EA59FD8D1B1558EE0006024F /* LaunchScreen.xib */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | EA59FD8E1B1558EE0006024F /* Base */, 273 | ); 274 | name = LaunchScreen.xib; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | EA59FD9C1B1558EE0006024F /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | }; 322 | name = Debug; 323 | }; 324 | EA59FD9D1B1558EE0006024F /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Release; 361 | }; 362 | EA59FD9F1B1558EE0006024F /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | INFOPLIST_FILE = FDActivityIndicatorViewDemo/Info.plist; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | }; 370 | name = Debug; 371 | }; 372 | EA59FDA01B1558EE0006024F /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | INFOPLIST_FILE = FDActivityIndicatorViewDemo/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | }; 380 | name = Release; 381 | }; 382 | EA59FDA21B1558EE0006024F /* Debug */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | BUNDLE_LOADER = "$(TEST_HOST)"; 386 | FRAMEWORK_SEARCH_PATHS = ( 387 | "$(SDKROOT)/Developer/Library/Frameworks", 388 | "$(inherited)", 389 | ); 390 | GCC_PREPROCESSOR_DEFINITIONS = ( 391 | "DEBUG=1", 392 | "$(inherited)", 393 | ); 394 | INFOPLIST_FILE = FDActivityIndicatorViewDemoTests/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FDActivityIndicatorViewDemo.app/FDActivityIndicatorViewDemo"; 398 | }; 399 | name = Debug; 400 | }; 401 | EA59FDA31B1558EE0006024F /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | BUNDLE_LOADER = "$(TEST_HOST)"; 405 | FRAMEWORK_SEARCH_PATHS = ( 406 | "$(SDKROOT)/Developer/Library/Frameworks", 407 | "$(inherited)", 408 | ); 409 | INFOPLIST_FILE = FDActivityIndicatorViewDemoTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FDActivityIndicatorViewDemo.app/FDActivityIndicatorViewDemo"; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | EA59FD761B1558ED0006024F /* Build configuration list for PBXProject "FDActivityIndicatorViewDemo" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | EA59FD9C1B1558EE0006024F /* Debug */, 423 | EA59FD9D1B1558EE0006024F /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | EA59FD9E1B1558EE0006024F /* Build configuration list for PBXNativeTarget "FDActivityIndicatorViewDemo" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | EA59FD9F1B1558EE0006024F /* Debug */, 432 | EA59FDA01B1558EE0006024F /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | }; 436 | EA59FDA11B1558EE0006024F /* Build configuration list for PBXNativeTarget "FDActivityIndicatorViewDemoTests" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | EA59FDA21B1558EE0006024F /* Debug */, 440 | EA59FDA31B1558EE0006024F /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | }; 444 | /* End XCConfigurationList section */ 445 | }; 446 | rootObject = EA59FD731B1558ED0006024F /* Project object */; 447 | } 448 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. 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 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. 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 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/FDActivityIndicatorView/FDActivityIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDActivityIndicatorView.h 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FDActivityIndicatorView : UIView 12 | 13 | @property (strong, nonatomic) UIColor *color; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/FDActivityIndicatorView/FDActivityIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FDActivityIndicatorView.m 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import "FDActivityIndicatorView.h" 10 | 11 | @implementation FDActivityIndicatorView 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | if (self = [super initWithFrame:frame]) { 15 | self.backgroundColor = [UIColor clearColor]; 16 | self.layer.masksToBounds = YES; 17 | self.layer.cornerRadius = self.frame.size.width / 2; 18 | 19 | [self addAnimation]; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)drawRect:(CGRect)rect { 25 | CGContextRef context = UIGraphicsGetCurrentContext(); 26 | for (int i = 0; i < 360; i++) { 27 | CGFloat beginAngle = M_PI * 2 / 360 * i; 28 | CGFloat toAngle = beginAngle + M_PI * 2 / 360; 29 | CGFloat alpha = 1.0 / 360 * (i + 1); 30 | [self drawCircleWithContext:context beginAngle:beginAngle toAngle:toAngle color:_color alpha:alpha]; 31 | } 32 | } 33 | 34 | // Draw the circle indicator view 35 | - (void)drawCircleWithContext:(CGContextRef)context beginAngle:(CGFloat)beginAngle toAngle:(CGFloat) toAngle color:(UIColor *)color alpha:(CGFloat)alpha { 36 | CGContextSaveGState(context); 37 | CGContextBeginPath(context); 38 | CGFloat r, g, b; 39 | [color getRed:&r green:&g blue:&b alpha:nil]; 40 | CGContextSetRGBStrokeColor(context, r, g, b, alpha); 41 | CGContextSetLineWidth(context, 5.0); 42 | CGContextAddArc(context, self.frame.size.width / 2, self.frame.size.height / 2, self.frame.size.width / 2, beginAngle, toAngle, 0); 43 | CGContextDrawPath(context, kCGPathStroke); 44 | } 45 | 46 | - (void)addAnimation { 47 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 48 | animation.removedOnCompletion = NO; 49 | animation.fillMode = kCAFillModeForwards; 50 | animation.fromValue = @(0); 51 | animation.toValue = @(M_PI * 2); 52 | animation.duration = 1.f; 53 | animation.repeatCount = INT_MAX; 54 | 55 | [self.layer addAnimation:animation forKey:@"rotate"]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.fergus.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "FDActivityIndicatorView.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | FDActivityIndicatorView *indicatorView1 = [[FDActivityIndicatorView alloc] initWithFrame:CGRectMake(20, 100, 50, 50)]; 21 | indicatorView1.color = [UIColor orangeColor]; 22 | [self.view addSubview:indicatorView1]; 23 | 24 | FDActivityIndicatorView *indicatorView2 = [[FDActivityIndicatorView alloc] initWithFrame:CGRectMake(150, 100, 100, 100)]; 25 | indicatorView2.color = [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]; 26 | [self.view addSubview:indicatorView2]; 27 | 28 | FDActivityIndicatorView *indicatorView3 = [[FDActivityIndicatorView alloc] initWithFrame:CGRectMake(50, 250, 200, 200)]; 29 | indicatorView3.color = [UIColor redColor]; 30 | [self.view addSubview:indicatorView3]; 31 | } 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FDActivityIndicatorViewDemo 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. 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 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemoTests/FDActivityIndicatorViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FDActivityIndicatorViewDemoTests.m 3 | // FDActivityIndicatorViewDemoTests 4 | // 5 | // Created by fergusding on 15/5/27. 6 | // Copyright (c) 2015年 fergusding. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface FDActivityIndicatorViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation FDActivityIndicatorViewDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FDActivityIndicatorViewDemo/FDActivityIndicatorViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.fergus.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 fergusding 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS-Custom-ActivityIndicatorView 2 | A custom ActivityIndicaotrView used in iOS. 3 | 4 | # Introduction 5 | 6 | FDActivityIndicatorView is a activity indicatorview which shows a circle rotating, it is similar to wechat login activity indicator view. Also it supports to set the size accroding to it's frame and set the color of the circle. 7 | 8 | ## ScreenShot 9 | 10 | ![circle-activityindicatorview](http://7xiamc.com1.z0.glb.clouddn.com/circle-indicatorview.png) 11 | 12 | # Get started 13 | 14 | 1. Down the FDActivityIndicatorView.h and FDActivityIndicatorView.m source file. 15 | 2. Add the two source files to your project. 16 | 3. Import the FDActivityIndicatorView.h file where you want to use it. 17 | 18 | # Usage 19 | 20 | ```Objective-C 21 | FDActivityIndicatorView *indicatorView = [[FDActivityIndicatorView alloc] initWithFrame:CGRectMake(50, 250, 200, 200)]; 22 | indicatorView.color = [UIColor redColor]; 23 | [self.view addSubview:indicatorView]; 24 | ``` 25 | 26 | #License 27 | MIT 28 | --------------------------------------------------------------------------------