├── .gitignore ├── LICENSE ├── PageControl ├── PageControl.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── PageControl │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── TestView.xib │ └── ViewController.swift └── PageControlTests │ ├── Info.plist │ └── PageControlTests.swift ├── README.md └── pagecontrol_sample.gif /.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 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Gabriel Theodoropoulos 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 | -------------------------------------------------------------------------------- /PageControl/PageControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C08C53E11B2F316F00DEC256 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C08C53E01B2F316F00DEC256 /* AppDelegate.swift */; }; 11 | C08C53E31B2F316F00DEC256 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C08C53E21B2F316F00DEC256 /* ViewController.swift */; }; 12 | C08C53E61B2F316F00DEC256 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C08C53E41B2F316F00DEC256 /* Main.storyboard */; }; 13 | C08C53E81B2F316F00DEC256 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C08C53E71B2F316F00DEC256 /* Images.xcassets */; }; 14 | C08C53EB1B2F316F00DEC256 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C08C53E91B2F316F00DEC256 /* LaunchScreen.xib */; }; 15 | C08C53F71B2F316F00DEC256 /* PageControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C08C53F61B2F316F00DEC256 /* PageControlTests.swift */; }; 16 | C08C54031B2F358700DEC256 /* TestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C08C54021B2F358700DEC256 /* TestView.xib */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | C08C53F11B2F316F00DEC256 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = C08C53D31B2F316F00DEC256 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = C08C53DA1B2F316F00DEC256; 25 | remoteInfo = PageControl; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | C08C53DB1B2F316F00DEC256 /* PageControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PageControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | C08C53DF1B2F316F00DEC256 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | C08C53E01B2F316F00DEC256 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | C08C53E21B2F316F00DEC256 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | C08C53E51B2F316F00DEC256 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | C08C53E71B2F316F00DEC256 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | C08C53EA1B2F316F00DEC256 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 37 | C08C53F01B2F316F00DEC256 /* PageControlTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PageControlTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | C08C53F51B2F316F00DEC256 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | C08C53F61B2F316F00DEC256 /* PageControlTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageControlTests.swift; sourceTree = ""; }; 40 | C08C54021B2F358700DEC256 /* TestView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TestView.xib; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | C08C53D81B2F316F00DEC256 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | C08C53ED1B2F316F00DEC256 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | C08C53D21B2F316F00DEC256 = { 62 | isa = PBXGroup; 63 | children = ( 64 | C08C53DD1B2F316F00DEC256 /* PageControl */, 65 | C08C53F31B2F316F00DEC256 /* PageControlTests */, 66 | C08C53DC1B2F316F00DEC256 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | C08C53DC1B2F316F00DEC256 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | C08C53DB1B2F316F00DEC256 /* PageControl.app */, 74 | C08C53F01B2F316F00DEC256 /* PageControlTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | C08C53DD1B2F316F00DEC256 /* PageControl */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | C08C53E01B2F316F00DEC256 /* AppDelegate.swift */, 83 | C08C53E21B2F316F00DEC256 /* ViewController.swift */, 84 | C08C53E41B2F316F00DEC256 /* Main.storyboard */, 85 | C08C54021B2F358700DEC256 /* TestView.xib */, 86 | C08C53E71B2F316F00DEC256 /* Images.xcassets */, 87 | C08C53E91B2F316F00DEC256 /* LaunchScreen.xib */, 88 | C08C53DE1B2F316F00DEC256 /* Supporting Files */, 89 | ); 90 | path = PageControl; 91 | sourceTree = ""; 92 | }; 93 | C08C53DE1B2F316F00DEC256 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | C08C53DF1B2F316F00DEC256 /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | C08C53F31B2F316F00DEC256 /* PageControlTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | C08C53F61B2F316F00DEC256 /* PageControlTests.swift */, 105 | C08C53F41B2F316F00DEC256 /* Supporting Files */, 106 | ); 107 | path = PageControlTests; 108 | sourceTree = ""; 109 | }; 110 | C08C53F41B2F316F00DEC256 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | C08C53F51B2F316F00DEC256 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | C08C53DA1B2F316F00DEC256 /* PageControl */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = C08C53FA1B2F316F00DEC256 /* Build configuration list for PBXNativeTarget "PageControl" */; 124 | buildPhases = ( 125 | C08C53D71B2F316F00DEC256 /* Sources */, 126 | C08C53D81B2F316F00DEC256 /* Frameworks */, 127 | C08C53D91B2F316F00DEC256 /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = PageControl; 134 | productName = PageControl; 135 | productReference = C08C53DB1B2F316F00DEC256 /* PageControl.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | C08C53EF1B2F316F00DEC256 /* PageControlTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = C08C53FD1B2F316F00DEC256 /* Build configuration list for PBXNativeTarget "PageControlTests" */; 141 | buildPhases = ( 142 | C08C53EC1B2F316F00DEC256 /* Sources */, 143 | C08C53ED1B2F316F00DEC256 /* Frameworks */, 144 | C08C53EE1B2F316F00DEC256 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | C08C53F21B2F316F00DEC256 /* PBXTargetDependency */, 150 | ); 151 | name = PageControlTests; 152 | productName = PageControlTests; 153 | productReference = C08C53F01B2F316F00DEC256 /* PageControlTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | C08C53D31B2F316F00DEC256 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0630; 163 | ORGANIZATIONNAME = "Gabriel Theodoropoulos"; 164 | TargetAttributes = { 165 | C08C53DA1B2F316F00DEC256 = { 166 | CreatedOnToolsVersion = 6.3; 167 | }; 168 | C08C53EF1B2F316F00DEC256 = { 169 | CreatedOnToolsVersion = 6.3; 170 | TestTargetID = C08C53DA1B2F316F00DEC256; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = C08C53D61B2F316F00DEC256 /* Build configuration list for PBXProject "PageControl" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = C08C53D21B2F316F00DEC256; 183 | productRefGroup = C08C53DC1B2F316F00DEC256 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | C08C53DA1B2F316F00DEC256 /* PageControl */, 188 | C08C53EF1B2F316F00DEC256 /* PageControlTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | C08C53D91B2F316F00DEC256 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | C08C54031B2F358700DEC256 /* TestView.xib in Resources */, 199 | C08C53E61B2F316F00DEC256 /* Main.storyboard in Resources */, 200 | C08C53EB1B2F316F00DEC256 /* LaunchScreen.xib in Resources */, 201 | C08C53E81B2F316F00DEC256 /* Images.xcassets in Resources */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | C08C53EE1B2F316F00DEC256 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXResourcesBuildPhase section */ 213 | 214 | /* Begin PBXSourcesBuildPhase section */ 215 | C08C53D71B2F316F00DEC256 /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | C08C53E31B2F316F00DEC256 /* ViewController.swift in Sources */, 220 | C08C53E11B2F316F00DEC256 /* AppDelegate.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | C08C53EC1B2F316F00DEC256 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | C08C53F71B2F316F00DEC256 /* PageControlTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | C08C53F21B2F316F00DEC256 /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = C08C53DA1B2F316F00DEC256 /* PageControl */; 238 | targetProxy = C08C53F11B2F316F00DEC256 /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | C08C53E41B2F316F00DEC256 /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | C08C53E51B2F316F00DEC256 /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | C08C53E91B2F316F00DEC256 /* LaunchScreen.xib */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | C08C53EA1B2F316F00DEC256 /* Base */, 255 | ); 256 | name = LaunchScreen.xib; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXVariantGroup section */ 260 | 261 | /* Begin XCBuildConfiguration section */ 262 | C08C53F81B2F316F00DEC256 /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BOOL_CONVERSION = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | GCC_C_LANGUAGE_STANDARD = gnu99; 284 | GCC_DYNAMIC_NO_PIC = NO; 285 | GCC_NO_COMMON_BLOCKS = YES; 286 | GCC_OPTIMIZATION_LEVEL = 0; 287 | GCC_PREPROCESSOR_DEFINITIONS = ( 288 | "DEBUG=1", 289 | "$(inherited)", 290 | ); 291 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 299 | MTL_ENABLE_DEBUG_INFO = YES; 300 | ONLY_ACTIVE_ARCH = YES; 301 | SDKROOT = iphoneos; 302 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | }; 305 | name = Debug; 306 | }; 307 | C08C53F91B2F316F00DEC256 /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_UNREACHABLE_CODE = YES; 323 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 324 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 325 | COPY_PHASE_STRIP = NO; 326 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 327 | ENABLE_NS_ASSERTIONS = NO; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu99; 330 | GCC_NO_COMMON_BLOCKS = YES; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | SDKROOT = iphoneos; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | VALIDATE_PRODUCT = YES; 342 | }; 343 | name = Release; 344 | }; 345 | C08C53FB1B2F316F00DEC256 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | INFOPLIST_FILE = PageControl/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Debug; 354 | }; 355 | C08C53FC1B2F316F00DEC256 /* Release */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 359 | INFOPLIST_FILE = PageControl/Info.plist; 360 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 361 | PRODUCT_NAME = "$(TARGET_NAME)"; 362 | }; 363 | name = Release; 364 | }; 365 | C08C53FE1B2F316F00DEC256 /* Debug */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | BUNDLE_LOADER = "$(TEST_HOST)"; 369 | FRAMEWORK_SEARCH_PATHS = ( 370 | "$(SDKROOT)/Developer/Library/Frameworks", 371 | "$(inherited)", 372 | ); 373 | GCC_PREPROCESSOR_DEFINITIONS = ( 374 | "DEBUG=1", 375 | "$(inherited)", 376 | ); 377 | INFOPLIST_FILE = PageControlTests/Info.plist; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PageControl.app/PageControl"; 381 | }; 382 | name = Debug; 383 | }; 384 | C08C53FF1B2F316F00DEC256 /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | BUNDLE_LOADER = "$(TEST_HOST)"; 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "$(SDKROOT)/Developer/Library/Frameworks", 390 | "$(inherited)", 391 | ); 392 | INFOPLIST_FILE = PageControlTests/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PageControl.app/PageControl"; 396 | }; 397 | name = Release; 398 | }; 399 | /* End XCBuildConfiguration section */ 400 | 401 | /* Begin XCConfigurationList section */ 402 | C08C53D61B2F316F00DEC256 /* Build configuration list for PBXProject "PageControl" */ = { 403 | isa = XCConfigurationList; 404 | buildConfigurations = ( 405 | C08C53F81B2F316F00DEC256 /* Debug */, 406 | C08C53F91B2F316F00DEC256 /* Release */, 407 | ); 408 | defaultConfigurationIsVisible = 0; 409 | defaultConfigurationName = Release; 410 | }; 411 | C08C53FA1B2F316F00DEC256 /* Build configuration list for PBXNativeTarget "PageControl" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | C08C53FB1B2F316F00DEC256 /* Debug */, 415 | C08C53FC1B2F316F00DEC256 /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | }; 419 | C08C53FD1B2F316F00DEC256 /* Build configuration list for PBXNativeTarget "PageControlTests" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | C08C53FE1B2F316F00DEC256 /* Debug */, 423 | C08C53FF1B2F316F00DEC256 /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | }; 427 | /* End XCConfigurationList section */ 428 | }; 429 | rootObject = C08C53D31B2F316F00DEC256 /* Project object */; 430 | } 431 | -------------------------------------------------------------------------------- /PageControl/PageControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PageControl/PageControl/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PageControl 4 | // 5 | // Created by Gabriel Theodoropoulos on 15/6/15. 6 | // Copyright (c) 2015 Gabriel Theodoropoulos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 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 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /PageControl/PageControl/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 | -------------------------------------------------------------------------------- /PageControl/PageControl/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /PageControl/PageControl/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 | } -------------------------------------------------------------------------------- /PageControl/PageControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.gabrieltheodoropoulos.$(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 | UIStatusBarHidden 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 | -------------------------------------------------------------------------------- /PageControl/PageControl/TestView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PageControl/PageControl/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // PageControl 4 | // 5 | // Created by Gabriel Theodoropoulos on 15/6/15. 6 | // Copyright (c) 2015 Gabriel Theodoropoulos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UIScrollViewDelegate { 12 | 13 | @IBOutlet weak var scrollView: UIScrollView! 14 | 15 | @IBOutlet weak var pageControl: UIPageControl! 16 | 17 | 18 | let totalPages = 5 19 | 20 | let sampleBGColors: Array = [UIColor.redColor(), UIColor.yellowColor(), UIColor.greenColor(), UIColor.magentaColor(), UIColor.orangeColor()] 21 | 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | // Do any additional setup after loading the view, typically from a nib. 26 | 27 | } 28 | 29 | 30 | override func viewDidAppear(animated: Bool) { 31 | super.viewDidAppear(animated) 32 | 33 | configureScrollView() 34 | configurePageControl() 35 | } 36 | 37 | 38 | override func didReceiveMemoryWarning() { 39 | super.didReceiveMemoryWarning() 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | 44 | override func preferredStatusBarStyle() -> UIStatusBarStyle { 45 | return UIStatusBarStyle.LightContent 46 | } 47 | 48 | 49 | // MARK: Custom method implementation 50 | 51 | func configureScrollView() { 52 | // Enable paging. 53 | scrollView.pagingEnabled = true 54 | 55 | // Set the following flag values. 56 | scrollView.showsHorizontalScrollIndicator = false 57 | scrollView.showsVerticalScrollIndicator = false 58 | scrollView.scrollsToTop = false 59 | 60 | // Set the scrollview content size. 61 | scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * CGFloat(totalPages), scrollView.frame.size.height) 62 | 63 | // Set self as the delegate of the scrollview. 64 | scrollView.delegate = self 65 | 66 | // Load the TestView view from the TestView.xib file and configure it properly. 67 | for var i=0; i 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.gabrieltheodoropoulos.$(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 | -------------------------------------------------------------------------------- /PageControl/PageControlTests/PageControlTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PageControlTests.swift 3 | // PageControlTests 4 | // 5 | // Created by Gabriel Theodoropoulos on 15/6/15. 6 | // Copyright (c) 2015 Gabriel Theodoropoulos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class PageControlTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## About ## 2 | 3 | A really simple demonstration on how to use the UIPageControl along with a scroll view in iOS. 4 | 5 | The project is written in Swift. 6 | 7 | ![Sample](https://raw.github.com/gabrieltheodoropoulos/iOS-Swift-PageControl/master/pagecontrol_sample.gif) 8 | -------------------------------------------------------------------------------- /pagecontrol_sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrieltheodoropoulos/iOS-Swift-PageControl/3c4065e4247e2b7de544565e88ce45e5d778b6c2/pagecontrol_sample.gif --------------------------------------------------------------------------------