├── .gitignore ├── LICENSE ├── README.md ├── TYDotIndicatorView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── TYDotIndicatorView ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── Main_iPad.storyboard │ └── Main_iPhone.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── TYDotIndicatorView-Info.plist ├── TYDotIndicatorView-Prefix.pch ├── TYDotIndicatorView │ ├── TYDotIndicatorView.h │ └── TYDotIndicatorView.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m └── TYDotIndicatorViewTests ├── TYDotIndicatorViewTests-Info.plist ├── TYDotIndicatorViewTests.m └── en.lproj └── InfoPlist.strings /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 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 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 itouch2 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TYDotIndicatorView 2 | ================== 3 | 4 | Animated dots to show the progress of something... (The light color dots with dark background look nice.) 5 | 6 | Specify the shape of dots by dotStyle (including squre, rounded corner and circle), the color of dot by dotColor and the size of dot by dotSize. 7 | 8 | Then, start animating... 9 | 10 | **Usage** 11 | 12 | TYDotIndicatorView *dot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 50, 260, 50) 13 | dotStyle:TYDotIndicatorViewStyleCircle 14 | dotColor:[UIColor greenColor] 15 | dotSize:CGSizeMake(15, 15)]; 16 | [self.view addSubview:dot]; 17 | [dot startAnimating]; 18 | 19 | **A Quick Peek** 20 | 21 | ![screenshots](https://f.cloud.github.com/assets/4316898/1912164/a2763078-7d36-11e3-8bd9-be440fbfc774.gif) 22 | -------------------------------------------------------------------------------- /TYDotIndicatorView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CB3DB12C18829C9A00FEB692 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB12B18829C9A00FEB692 /* Foundation.framework */; }; 11 | CB3DB12E18829C9A00FEB692 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB12D18829C9A00FEB692 /* CoreGraphics.framework */; }; 12 | CB3DB13018829C9A00FEB692 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB12F18829C9A00FEB692 /* UIKit.framework */; }; 13 | CB3DB13618829C9A00FEB692 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CB3DB13418829C9A00FEB692 /* InfoPlist.strings */; }; 14 | CB3DB13818829C9A00FEB692 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CB3DB13718829C9A00FEB692 /* main.m */; }; 15 | CB3DB13C18829C9A00FEB692 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CB3DB13B18829C9A00FEB692 /* AppDelegate.m */; }; 16 | CB3DB13F18829C9A00FEB692 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB3DB13D18829C9A00FEB692 /* Main_iPhone.storyboard */; }; 17 | CB3DB14218829C9A00FEB692 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB3DB14018829C9A00FEB692 /* Main_iPad.storyboard */; }; 18 | CB3DB14518829C9A00FEB692 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB3DB14418829C9A00FEB692 /* ViewController.m */; }; 19 | CB3DB14718829C9A00FEB692 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB3DB14618829C9A00FEB692 /* Images.xcassets */; }; 20 | CB3DB14E18829C9A00FEB692 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB14D18829C9A00FEB692 /* XCTest.framework */; }; 21 | CB3DB14F18829C9A00FEB692 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB12B18829C9A00FEB692 /* Foundation.framework */; }; 22 | CB3DB15018829C9A00FEB692 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB3DB12F18829C9A00FEB692 /* UIKit.framework */; }; 23 | CB3DB15818829C9A00FEB692 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CB3DB15618829C9A00FEB692 /* InfoPlist.strings */; }; 24 | CB3DB15A18829C9A00FEB692 /* TYDotIndicatorViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB3DB15918829C9A00FEB692 /* TYDotIndicatorViewTests.m */; }; 25 | CB3DB16618829CD700FEB692 /* TYDotIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = CB3DB16518829CD700FEB692 /* TYDotIndicatorView.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | CB3DB15118829C9A00FEB692 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = CB3DB12018829C9A00FEB692 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = CB3DB12718829C9A00FEB692; 34 | remoteInfo = TYDotIndicatorView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | CB3DB12818829C9A00FEB692 /* TYDotIndicatorView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TYDotIndicatorView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | CB3DB12B18829C9A00FEB692 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | CB3DB12D18829C9A00FEB692 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | CB3DB12F18829C9A00FEB692 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | CB3DB13318829C9A00FEB692 /* TYDotIndicatorView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TYDotIndicatorView-Info.plist"; sourceTree = ""; }; 44 | CB3DB13518829C9A00FEB692 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | CB3DB13718829C9A00FEB692 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | CB3DB13918829C9A00FEB692 /* TYDotIndicatorView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TYDotIndicatorView-Prefix.pch"; sourceTree = ""; }; 47 | CB3DB13A18829C9A00FEB692 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | CB3DB13B18829C9A00FEB692 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | CB3DB13E18829C9A00FEB692 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; 50 | CB3DB14118829C9A00FEB692 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; 51 | CB3DB14318829C9A00FEB692 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | CB3DB14418829C9A00FEB692 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | CB3DB14618829C9A00FEB692 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | CB3DB14C18829C9A00FEB692 /* TYDotIndicatorViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TYDotIndicatorViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | CB3DB14D18829C9A00FEB692 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 56 | CB3DB15518829C9A00FEB692 /* TYDotIndicatorViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TYDotIndicatorViewTests-Info.plist"; sourceTree = ""; }; 57 | CB3DB15718829C9A00FEB692 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 58 | CB3DB15918829C9A00FEB692 /* TYDotIndicatorViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TYDotIndicatorViewTests.m; sourceTree = ""; }; 59 | CB3DB16418829CD700FEB692 /* TYDotIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TYDotIndicatorView.h; sourceTree = ""; }; 60 | CB3DB16518829CD700FEB692 /* TYDotIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TYDotIndicatorView.m; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | CB3DB12518829C9A00FEB692 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | CB3DB12E18829C9A00FEB692 /* CoreGraphics.framework in Frameworks */, 69 | CB3DB13018829C9A00FEB692 /* UIKit.framework in Frameworks */, 70 | CB3DB12C18829C9A00FEB692 /* Foundation.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | CB3DB14918829C9A00FEB692 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | CB3DB14E18829C9A00FEB692 /* XCTest.framework in Frameworks */, 79 | CB3DB15018829C9A00FEB692 /* UIKit.framework in Frameworks */, 80 | CB3DB14F18829C9A00FEB692 /* Foundation.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | CB3DB11F18829C9A00FEB692 = { 88 | isa = PBXGroup; 89 | children = ( 90 | CB3DB13118829C9A00FEB692 /* TYDotIndicatorView */, 91 | CB3DB15318829C9A00FEB692 /* TYDotIndicatorViewTests */, 92 | CB3DB12A18829C9A00FEB692 /* Frameworks */, 93 | CB3DB12918829C9A00FEB692 /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | CB3DB12918829C9A00FEB692 /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | CB3DB12818829C9A00FEB692 /* TYDotIndicatorView.app */, 101 | CB3DB14C18829C9A00FEB692 /* TYDotIndicatorViewTests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | CB3DB12A18829C9A00FEB692 /* Frameworks */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | CB3DB12B18829C9A00FEB692 /* Foundation.framework */, 110 | CB3DB12D18829C9A00FEB692 /* CoreGraphics.framework */, 111 | CB3DB12F18829C9A00FEB692 /* UIKit.framework */, 112 | CB3DB14D18829C9A00FEB692 /* XCTest.framework */, 113 | ); 114 | name = Frameworks; 115 | sourceTree = ""; 116 | }; 117 | CB3DB13118829C9A00FEB692 /* TYDotIndicatorView */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | CB3DB16318829CCA00FEB692 /* TYDotIndicatorView */, 121 | CB3DB13A18829C9A00FEB692 /* AppDelegate.h */, 122 | CB3DB13B18829C9A00FEB692 /* AppDelegate.m */, 123 | CB3DB13D18829C9A00FEB692 /* Main_iPhone.storyboard */, 124 | CB3DB14018829C9A00FEB692 /* Main_iPad.storyboard */, 125 | CB3DB14318829C9A00FEB692 /* ViewController.h */, 126 | CB3DB14418829C9A00FEB692 /* ViewController.m */, 127 | CB3DB14618829C9A00FEB692 /* Images.xcassets */, 128 | CB3DB13218829C9A00FEB692 /* Supporting Files */, 129 | ); 130 | path = TYDotIndicatorView; 131 | sourceTree = ""; 132 | }; 133 | CB3DB13218829C9A00FEB692 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | CB3DB13318829C9A00FEB692 /* TYDotIndicatorView-Info.plist */, 137 | CB3DB13418829C9A00FEB692 /* InfoPlist.strings */, 138 | CB3DB13718829C9A00FEB692 /* main.m */, 139 | CB3DB13918829C9A00FEB692 /* TYDotIndicatorView-Prefix.pch */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | CB3DB15318829C9A00FEB692 /* TYDotIndicatorViewTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | CB3DB15918829C9A00FEB692 /* TYDotIndicatorViewTests.m */, 148 | CB3DB15418829C9A00FEB692 /* Supporting Files */, 149 | ); 150 | path = TYDotIndicatorViewTests; 151 | sourceTree = ""; 152 | }; 153 | CB3DB15418829C9A00FEB692 /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | CB3DB15518829C9A00FEB692 /* TYDotIndicatorViewTests-Info.plist */, 157 | CB3DB15618829C9A00FEB692 /* InfoPlist.strings */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | CB3DB16318829CCA00FEB692 /* TYDotIndicatorView */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | CB3DB16418829CD700FEB692 /* TYDotIndicatorView.h */, 166 | CB3DB16518829CD700FEB692 /* TYDotIndicatorView.m */, 167 | ); 168 | path = TYDotIndicatorView; 169 | sourceTree = ""; 170 | }; 171 | /* End PBXGroup section */ 172 | 173 | /* Begin PBXNativeTarget section */ 174 | CB3DB12718829C9A00FEB692 /* TYDotIndicatorView */ = { 175 | isa = PBXNativeTarget; 176 | buildConfigurationList = CB3DB15D18829C9A00FEB692 /* Build configuration list for PBXNativeTarget "TYDotIndicatorView" */; 177 | buildPhases = ( 178 | CB3DB12418829C9A00FEB692 /* Sources */, 179 | CB3DB12518829C9A00FEB692 /* Frameworks */, 180 | CB3DB12618829C9A00FEB692 /* Resources */, 181 | ); 182 | buildRules = ( 183 | ); 184 | dependencies = ( 185 | ); 186 | name = TYDotIndicatorView; 187 | productName = TYDotIndicatorView; 188 | productReference = CB3DB12818829C9A00FEB692 /* TYDotIndicatorView.app */; 189 | productType = "com.apple.product-type.application"; 190 | }; 191 | CB3DB14B18829C9A00FEB692 /* TYDotIndicatorViewTests */ = { 192 | isa = PBXNativeTarget; 193 | buildConfigurationList = CB3DB16018829C9A00FEB692 /* Build configuration list for PBXNativeTarget "TYDotIndicatorViewTests" */; 194 | buildPhases = ( 195 | CB3DB14818829C9A00FEB692 /* Sources */, 196 | CB3DB14918829C9A00FEB692 /* Frameworks */, 197 | CB3DB14A18829C9A00FEB692 /* Resources */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | CB3DB15218829C9A00FEB692 /* PBXTargetDependency */, 203 | ); 204 | name = TYDotIndicatorViewTests; 205 | productName = TYDotIndicatorViewTests; 206 | productReference = CB3DB14C18829C9A00FEB692 /* TYDotIndicatorViewTests.xctest */; 207 | productType = "com.apple.product-type.bundle.unit-test"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | CB3DB12018829C9A00FEB692 /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | LastUpgradeCheck = 0500; 216 | ORGANIZATIONNAME = "Tu You"; 217 | TargetAttributes = { 218 | CB3DB14B18829C9A00FEB692 = { 219 | TestTargetID = CB3DB12718829C9A00FEB692; 220 | }; 221 | }; 222 | }; 223 | buildConfigurationList = CB3DB12318829C9A00FEB692 /* Build configuration list for PBXProject "TYDotIndicatorView" */; 224 | compatibilityVersion = "Xcode 3.2"; 225 | developmentRegion = English; 226 | hasScannedForEncodings = 0; 227 | knownRegions = ( 228 | en, 229 | Base, 230 | ); 231 | mainGroup = CB3DB11F18829C9A00FEB692; 232 | productRefGroup = CB3DB12918829C9A00FEB692 /* Products */; 233 | projectDirPath = ""; 234 | projectRoot = ""; 235 | targets = ( 236 | CB3DB12718829C9A00FEB692 /* TYDotIndicatorView */, 237 | CB3DB14B18829C9A00FEB692 /* TYDotIndicatorViewTests */, 238 | ); 239 | }; 240 | /* End PBXProject section */ 241 | 242 | /* Begin PBXResourcesBuildPhase section */ 243 | CB3DB12618829C9A00FEB692 /* Resources */ = { 244 | isa = PBXResourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | CB3DB14218829C9A00FEB692 /* Main_iPad.storyboard in Resources */, 248 | CB3DB14718829C9A00FEB692 /* Images.xcassets in Resources */, 249 | CB3DB13F18829C9A00FEB692 /* Main_iPhone.storyboard in Resources */, 250 | CB3DB13618829C9A00FEB692 /* InfoPlist.strings in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | CB3DB14A18829C9A00FEB692 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | CB3DB15818829C9A00FEB692 /* InfoPlist.strings in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXSourcesBuildPhase section */ 265 | CB3DB12418829C9A00FEB692 /* Sources */ = { 266 | isa = PBXSourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | CB3DB14518829C9A00FEB692 /* ViewController.m in Sources */, 270 | CB3DB13C18829C9A00FEB692 /* AppDelegate.m in Sources */, 271 | CB3DB13818829C9A00FEB692 /* main.m in Sources */, 272 | CB3DB16618829CD700FEB692 /* TYDotIndicatorView.m in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | CB3DB14818829C9A00FEB692 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | CB3DB15A18829C9A00FEB692 /* TYDotIndicatorViewTests.m in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXSourcesBuildPhase section */ 285 | 286 | /* Begin PBXTargetDependency section */ 287 | CB3DB15218829C9A00FEB692 /* PBXTargetDependency */ = { 288 | isa = PBXTargetDependency; 289 | target = CB3DB12718829C9A00FEB692 /* TYDotIndicatorView */; 290 | targetProxy = CB3DB15118829C9A00FEB692 /* PBXContainerItemProxy */; 291 | }; 292 | /* End PBXTargetDependency section */ 293 | 294 | /* Begin PBXVariantGroup section */ 295 | CB3DB13418829C9A00FEB692 /* InfoPlist.strings */ = { 296 | isa = PBXVariantGroup; 297 | children = ( 298 | CB3DB13518829C9A00FEB692 /* en */, 299 | ); 300 | name = InfoPlist.strings; 301 | sourceTree = ""; 302 | }; 303 | CB3DB13D18829C9A00FEB692 /* Main_iPhone.storyboard */ = { 304 | isa = PBXVariantGroup; 305 | children = ( 306 | CB3DB13E18829C9A00FEB692 /* Base */, 307 | ); 308 | name = Main_iPhone.storyboard; 309 | sourceTree = ""; 310 | }; 311 | CB3DB14018829C9A00FEB692 /* Main_iPad.storyboard */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | CB3DB14118829C9A00FEB692 /* Base */, 315 | ); 316 | name = Main_iPad.storyboard; 317 | sourceTree = ""; 318 | }; 319 | CB3DB15618829C9A00FEB692 /* InfoPlist.strings */ = { 320 | isa = PBXVariantGroup; 321 | children = ( 322 | CB3DB15718829C9A00FEB692 /* en */, 323 | ); 324 | name = InfoPlist.strings; 325 | sourceTree = ""; 326 | }; 327 | /* End PBXVariantGroup section */ 328 | 329 | /* Begin XCBuildConfiguration section */ 330 | CB3DB15B18829C9A00FEB692 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | GCC_C_LANGUAGE_STANDARD = gnu99; 350 | GCC_DYNAMIC_NO_PIC = NO; 351 | GCC_OPTIMIZATION_LEVEL = 0; 352 | GCC_PREPROCESSOR_DEFINITIONS = ( 353 | "DEBUG=1", 354 | "$(inherited)", 355 | ); 356 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 364 | ONLY_ACTIVE_ARCH = YES; 365 | SDKROOT = iphoneos; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | }; 368 | name = Debug; 369 | }; 370 | CB3DB15C18829C9A00FEB692 /* Release */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BOOL_CONVERSION = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 382 | CLANG_WARN_EMPTY_BODY = YES; 383 | CLANG_WARN_ENUM_CONVERSION = YES; 384 | CLANG_WARN_INT_CONVERSION = YES; 385 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 386 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 387 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 388 | COPY_PHASE_STRIP = YES; 389 | ENABLE_NS_ASSERTIONS = NO; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 393 | GCC_WARN_UNDECLARED_SELECTOR = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 395 | GCC_WARN_UNUSED_FUNCTION = YES; 396 | GCC_WARN_UNUSED_VARIABLE = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 398 | SDKROOT = iphoneos; 399 | TARGETED_DEVICE_FAMILY = "1,2"; 400 | VALIDATE_PRODUCT = YES; 401 | }; 402 | name = Release; 403 | }; 404 | CB3DB15E18829C9A00FEB692 /* Debug */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 408 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 409 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 410 | GCC_PREFIX_HEADER = "TYDotIndicatorView/TYDotIndicatorView-Prefix.pch"; 411 | INFOPLIST_FILE = "TYDotIndicatorView/TYDotIndicatorView-Info.plist"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | WRAPPER_EXTENSION = app; 414 | }; 415 | name = Debug; 416 | }; 417 | CB3DB15F18829C9A00FEB692 /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 422 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 423 | GCC_PREFIX_HEADER = "TYDotIndicatorView/TYDotIndicatorView-Prefix.pch"; 424 | INFOPLIST_FILE = "TYDotIndicatorView/TYDotIndicatorView-Info.plist"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | WRAPPER_EXTENSION = app; 427 | }; 428 | name = Release; 429 | }; 430 | CB3DB16118829C9A00FEB692 /* Debug */ = { 431 | isa = XCBuildConfiguration; 432 | buildSettings = { 433 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 434 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TYDotIndicatorView.app/TYDotIndicatorView"; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(SDKROOT)/Developer/Library/Frameworks", 437 | "$(inherited)", 438 | "$(DEVELOPER_FRAMEWORKS_DIR)", 439 | ); 440 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 441 | GCC_PREFIX_HEADER = "TYDotIndicatorView/TYDotIndicatorView-Prefix.pch"; 442 | GCC_PREPROCESSOR_DEFINITIONS = ( 443 | "DEBUG=1", 444 | "$(inherited)", 445 | ); 446 | INFOPLIST_FILE = "TYDotIndicatorViewTests/TYDotIndicatorViewTests-Info.plist"; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | TEST_HOST = "$(BUNDLE_LOADER)"; 449 | WRAPPER_EXTENSION = xctest; 450 | }; 451 | name = Debug; 452 | }; 453 | CB3DB16218829C9A00FEB692 /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 457 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TYDotIndicatorView.app/TYDotIndicatorView"; 458 | FRAMEWORK_SEARCH_PATHS = ( 459 | "$(SDKROOT)/Developer/Library/Frameworks", 460 | "$(inherited)", 461 | "$(DEVELOPER_FRAMEWORKS_DIR)", 462 | ); 463 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 464 | GCC_PREFIX_HEADER = "TYDotIndicatorView/TYDotIndicatorView-Prefix.pch"; 465 | INFOPLIST_FILE = "TYDotIndicatorViewTests/TYDotIndicatorViewTests-Info.plist"; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | TEST_HOST = "$(BUNDLE_LOADER)"; 468 | WRAPPER_EXTENSION = xctest; 469 | }; 470 | name = Release; 471 | }; 472 | /* End XCBuildConfiguration section */ 473 | 474 | /* Begin XCConfigurationList section */ 475 | CB3DB12318829C9A00FEB692 /* Build configuration list for PBXProject "TYDotIndicatorView" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | CB3DB15B18829C9A00FEB692 /* Debug */, 479 | CB3DB15C18829C9A00FEB692 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | CB3DB15D18829C9A00FEB692 /* Build configuration list for PBXNativeTarget "TYDotIndicatorView" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | CB3DB15E18829C9A00FEB692 /* Debug */, 488 | CB3DB15F18829C9A00FEB692 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | }; 492 | CB3DB16018829C9A00FEB692 /* Build configuration list for PBXNativeTarget "TYDotIndicatorViewTests" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | CB3DB16118829C9A00FEB692 /* Debug */, 496 | CB3DB16218829C9A00FEB692 /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | }; 500 | /* End XCConfigurationList section */ 501 | }; 502 | rootObject = CB3DB12018829C9A00FEB692 /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /TYDotIndicatorView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TYDotIndicatorView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TYDotIndicatorView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 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 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /TYDotIndicatorView/Base.lproj/Main_iPad.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 | -------------------------------------------------------------------------------- /TYDotIndicatorView/Base.lproj/Main_iPhone.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 | -------------------------------------------------------------------------------- /TYDotIndicatorView/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /TYDotIndicatorView/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /TYDotIndicatorView/TYDotIndicatorView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | COM.TUYOU.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /TYDotIndicatorView/TYDotIndicatorView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /TYDotIndicatorView/TYDotIndicatorView/TYDotIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TYDotIndicatorView.h 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, TYDotIndicatorViewStyle) 12 | { 13 | TYDotIndicatorViewStyleSquare, 14 | TYDotIndicatorViewStyleRound, 15 | TYDotIndicatorViewStyleCircle 16 | }; 17 | 18 | @interface TYDotIndicatorView : UIView 19 | 20 | @property (nonatomic, assign) BOOL hidesWhenStopped; 21 | 22 | - (id)initWithFrame:(CGRect)frame 23 | dotStyle:(TYDotIndicatorViewStyle)style 24 | dotColor:(UIColor *)dotColor 25 | dotSize:(CGSize)dotSize; 26 | 27 | - (void)startAnimating; 28 | - (void)stopAnimating; 29 | - (BOOL)isAnimating; 30 | 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /TYDotIndicatorView/TYDotIndicatorView/TYDotIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TYDotIndicatorView.m 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "TYDotIndicatorView.h" 10 | 11 | static const NSUInteger dotNumber = 3; 12 | static const CGFloat dotSeparatorDistance = 12.0f; 13 | 14 | @interface TYDotIndicatorView () 15 | 16 | @property (nonatomic, assign) TYDotIndicatorViewStyle dotStyle; 17 | @property (nonatomic, assign) CGSize dotSize; 18 | @property (nonatomic, retain) NSMutableArray *dots; 19 | @property (nonatomic, assign) BOOL animating; 20 | 21 | @end 22 | 23 | @implementation TYDotIndicatorView 24 | 25 | - (id)initWithFrame:(CGRect)frame 26 | dotStyle:(TYDotIndicatorViewStyle)style 27 | dotColor:(UIColor *)dotColor 28 | dotSize:(CGSize)dotSize 29 | { 30 | self = [super initWithFrame:frame]; 31 | 32 | if (self) 33 | { 34 | _dotStyle = style; 35 | _dotSize = dotSize; 36 | _hidesWhenStopped = YES; 37 | 38 | _dots = [[NSMutableArray alloc] init]; 39 | 40 | CGFloat xPos = CGRectGetWidth(frame) / 2 - dotSize.width * 3 / 2 - dotSeparatorDistance; 41 | CGFloat yPos = CGRectGetHeight(frame) / 2 - _dotSize.height / 2; 42 | 43 | for (int i = 0; i < dotNumber; i++) 44 | { 45 | CAShapeLayer *dot = [CAShapeLayer new]; 46 | dot.path = [self createDotPath].CGPath; 47 | dot.frame = CGRectMake(xPos, yPos, _dotSize.width, _dotSize.height); 48 | dot.opacity = 0.3 * (dotNumber - i); 49 | dot.fillColor = dotColor.CGColor; 50 | 51 | [self.layer addSublayer:dot]; 52 | 53 | [_dots addObject:dot]; 54 | 55 | xPos = xPos + (dotSeparatorDistance + _dotSize.width); 56 | } 57 | 58 | } 59 | return self; 60 | } 61 | 62 | - (UIBezierPath *)createDotPath 63 | { 64 | CGFloat cornerRadius = 0.0f; 65 | if (_dotStyle == TYDotIndicatorViewStyleSquare) 66 | { 67 | cornerRadius = 0.0f; 68 | } 69 | else if (_dotStyle == TYDotIndicatorViewStyleRound) 70 | { 71 | cornerRadius = 2; 72 | } 73 | else if (_dotStyle == TYDotIndicatorViewStyleCircle) 74 | { 75 | cornerRadius = self.dotSize.width / 2; 76 | } 77 | 78 | UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.dotSize.width, self.dotSize.height) cornerRadius:cornerRadius]; 79 | 80 | return bezierPath; 81 | } 82 | 83 | - (CAAnimation *)fadeInAnimation:(CFTimeInterval)delay 84 | { 85 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 86 | animation.fromValue = @(0.3f); 87 | animation.toValue = @(1.0f); 88 | animation.duration = 0.8f; 89 | animation.beginTime = CACurrentMediaTime() + delay; 90 | animation.autoreverses = YES; 91 | animation.repeatCount = HUGE_VAL; 92 | return animation; 93 | } 94 | 95 | - (void)startAnimating 96 | { 97 | if (_animating) 98 | { 99 | return; 100 | } 101 | 102 | for (int i = 0; i < _dots.count; i++) 103 | { 104 | [_dots[i] addAnimation:[self fadeInAnimation:i * 0.25] forKey:@"fadeIn"]; 105 | } 106 | 107 | _animating = YES; 108 | } 109 | 110 | - (void)stopAnimating 111 | { 112 | if (!_animating) 113 | { 114 | return; 115 | } 116 | 117 | for (int i = 0; i < _dots.count; i++) 118 | { 119 | [_dots[i] addAnimation:[self fadeInAnimation:i * 0.4] forKey:@"fadeIn"]; 120 | } 121 | 122 | _animating = NO; 123 | 124 | if (_hidesWhenStopped) 125 | { 126 | // fade out to disappear 127 | [UIView animateWithDuration:0.2 animations:^{ 128 | self.alpha = 0.0f; 129 | } completion:^(BOOL finished) { 130 | [self removeFromSuperview]; 131 | }]; 132 | } 133 | } 134 | 135 | - (BOOL)isAnimating 136 | { 137 | return _animating; 138 | } 139 | 140 | - (void)removeFromSuperview 141 | { 142 | [self stopAnimating]; 143 | 144 | [super removeFromSuperview]; 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /TYDotIndicatorView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TYDotIndicatorView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TYDotIndicatorView.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | 23 | TYDotIndicatorView *squareDot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 50, 260, 50) dotStyle:TYDotIndicatorViewStyleSquare dotColor:[UIColor greenColor] dotSize:CGSizeMake(14, 14)]; 24 | squareDot.backgroundColor = [UIColor colorWithRed:0.83f green:0.89f blue:1.00f alpha:1.00f];; 25 | squareDot.layer.cornerRadius = 5.0f; 26 | [squareDot startAnimating]; 27 | [self.view addSubview:squareDot]; 28 | 29 | TYDotIndicatorView *roundedRectDot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 130, 260, 50) dotStyle:TYDotIndicatorViewStyleRound dotColor:[UIColor redColor] dotSize:CGSizeMake(15, 15)]; 30 | roundedRectDot.backgroundColor = [UIColor colorWithRed:0.98f green:0.97f blue:0.55f alpha:1.00f]; 31 | roundedRectDot.layer.cornerRadius = 5.0f; 32 | [roundedRectDot startAnimating]; 33 | [self.view addSubview:roundedRectDot]; 34 | 35 | TYDotIndicatorView *circleDot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 210, 260, 50) dotStyle:TYDotIndicatorViewStyleCircle dotColor:[UIColor blueColor] dotSize:CGSizeMake(16, 16)]; 36 | circleDot.backgroundColor = [UIColor colorWithRed:0.95f green:0.79f blue:1.00f alpha:1.00f]; 37 | circleDot.layer.cornerRadius = 5.0f; 38 | [circleDot startAnimating]; 39 | [self.view addSubview:circleDot]; 40 | 41 | TYDotIndicatorView *darkRoundedRectDot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 290, 260, 50) dotStyle:TYDotIndicatorViewStyleRound dotColor:[UIColor colorWithRed:0.85f green:0.86f blue:0.88f alpha:1.00f] dotSize:CGSizeMake(15, 15)]; 42 | darkRoundedRectDot.backgroundColor = [UIColor colorWithRed:0.20f green:0.27f blue:0.36f alpha:1.00f]; 43 | darkRoundedRectDot.layer.cornerRadius = 5.0f; 44 | [darkRoundedRectDot startAnimating]; 45 | [self.view addSubview:darkRoundedRectDot]; 46 | 47 | TYDotIndicatorView *darkCircleDot = [[TYDotIndicatorView alloc] initWithFrame:CGRectMake(30, 370, 260, 50) dotStyle:TYDotIndicatorViewStyleCircle dotColor:[UIColor colorWithWhite:0.8 alpha:1.0] dotSize:CGSizeMake(15, 15)]; 48 | darkCircleDot.backgroundColor = [UIColor colorWithRed:0.22 green:0.22 blue:0.22 alpha:1.0]; 49 | [darkCircleDot startAnimating]; 50 | darkCircleDot.layer.cornerRadius = 5.0f; 51 | [self.view addSubview:darkCircleDot]; 52 | 53 | UILabel *dotLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 510, 320, 22)]; 54 | dotLabel.backgroundColor = [UIColor clearColor]; 55 | dotLabel.textAlignment = NSTextAlignmentCenter; 56 | dotLabel.font = [UIFont fontWithName:@"HelveticaNeue-UltraLightItalic" size:18]; 57 | dotLabel.textColor = [UIColor orangeColor]; 58 | dotLabel.text = @"TYDotIndicatorView"; 59 | [self.view addSubview:dotLabel]; 60 | } 61 | 62 | - (void)didReceiveMemoryWarning 63 | { 64 | [super didReceiveMemoryWarning]; 65 | // Dispose of any resources that can be recreated. 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /TYDotIndicatorView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TYDotIndicatorView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TYDotIndicatorView 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TYDotIndicatorViewTests/TYDotIndicatorViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | COM.TUYOU.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /TYDotIndicatorViewTests/TYDotIndicatorViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TYDotIndicatorViewTests.m 3 | // TYDotIndicatorViewTests 4 | // 5 | // Created by Tu You on 14-1-12. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TYDotIndicatorViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TYDotIndicatorViewTests 16 | 17 | - (void)setUp 18 | { 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 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /TYDotIndicatorViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------