├── .DS_Store ├── JhPageControl.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── jh.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── lantongmac.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── jh.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── lantongmac.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── JhPageControl ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── JhPageControl.h ├── JhPageControl.m ├── ViewController.h ├── ViewController.m ├── main.m └── screenshots │ ├── .DS_Store │ └── 1.gif ├── JhPageControlTests ├── Info.plist └── JhPageControlTests.m ├── JhPageControlUITests ├── Info.plist └── JhPageControlUITests.m └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/.DS_Store -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E989661621A6BFA30031C5D8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E989661521A6BFA30031C5D8 /* AppDelegate.m */; }; 11 | E989661921A6BFA30031C5D8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E989661821A6BFA30031C5D8 /* ViewController.m */; }; 12 | E989661C21A6BFA30031C5D8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E989661A21A6BFA30031C5D8 /* Main.storyboard */; }; 13 | E989661E21A6BFA50031C5D8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E989661D21A6BFA50031C5D8 /* Assets.xcassets */; }; 14 | E989662121A6BFA50031C5D8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E989661F21A6BFA50031C5D8 /* LaunchScreen.storyboard */; }; 15 | E989662421A6BFA50031C5D8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E989662321A6BFA50031C5D8 /* main.m */; }; 16 | E989662E21A6BFA50031C5D8 /* JhPageControlTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E989662D21A6BFA50031C5D8 /* JhPageControlTests.m */; }; 17 | E989663921A6BFA50031C5D8 /* JhPageControlUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E989663821A6BFA50031C5D8 /* JhPageControlUITests.m */; }; 18 | E989664821A6BFC10031C5D8 /* JhPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = E989664721A6BFC10031C5D8 /* JhPageControl.m */; }; 19 | E9C0ED7421A78429009D812D /* 1.gif in Resources */ = {isa = PBXBuildFile; fileRef = E9C0ED7321A78429009D812D /* 1.gif */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | E989662A21A6BFA50031C5D8 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = E989660921A6BFA30031C5D8 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = E989661021A6BFA30031C5D8; 28 | remoteInfo = JhPageControl; 29 | }; 30 | E989663521A6BFA50031C5D8 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = E989660921A6BFA30031C5D8 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = E989661021A6BFA30031C5D8; 35 | remoteInfo = JhPageControl; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | E989661121A6BFA30031C5D8 /* JhPageControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JhPageControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | E989661421A6BFA30031C5D8 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | E989661521A6BFA30031C5D8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | E989661721A6BFA30031C5D8 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | E989661821A6BFA30031C5D8 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | E989661B21A6BFA30031C5D8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | E989661D21A6BFA50031C5D8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | E989662021A6BFA50031C5D8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | E989662221A6BFA50031C5D8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | E989662321A6BFA50031C5D8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 50 | E989662921A6BFA50031C5D8 /* JhPageControlTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JhPageControlTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | E989662D21A6BFA50031C5D8 /* JhPageControlTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JhPageControlTests.m; sourceTree = ""; }; 52 | E989662F21A6BFA50031C5D8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | E989663421A6BFA50031C5D8 /* JhPageControlUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JhPageControlUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | E989663821A6BFA50031C5D8 /* JhPageControlUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JhPageControlUITests.m; sourceTree = ""; }; 55 | E989663A21A6BFA50031C5D8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | E989664621A6BFC00031C5D8 /* JhPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JhPageControl.h; sourceTree = ""; }; 57 | E989664721A6BFC10031C5D8 /* JhPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JhPageControl.m; sourceTree = ""; }; 58 | E9C0ED7321A78429009D812D /* 1.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = 1.gif; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | E989660E21A6BFA30031C5D8 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | E989662621A6BFA50031C5D8 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | E989663121A6BFA50031C5D8 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | E989660821A6BFA30031C5D8 = { 87 | isa = PBXGroup; 88 | children = ( 89 | E989661321A6BFA30031C5D8 /* JhPageControl */, 90 | E989662C21A6BFA50031C5D8 /* JhPageControlTests */, 91 | E989663721A6BFA50031C5D8 /* JhPageControlUITests */, 92 | E989661221A6BFA30031C5D8 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | E989661221A6BFA30031C5D8 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | E989661121A6BFA30031C5D8 /* JhPageControl.app */, 100 | E989662921A6BFA50031C5D8 /* JhPageControlTests.xctest */, 101 | E989663421A6BFA50031C5D8 /* JhPageControlUITests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | E989661321A6BFA30031C5D8 /* JhPageControl */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | E9C0ED6E21A78412009D812D /* screenshots */, 110 | E989664621A6BFC00031C5D8 /* JhPageControl.h */, 111 | E989664721A6BFC10031C5D8 /* JhPageControl.m */, 112 | E989661421A6BFA30031C5D8 /* AppDelegate.h */, 113 | E989661521A6BFA30031C5D8 /* AppDelegate.m */, 114 | E989661721A6BFA30031C5D8 /* ViewController.h */, 115 | E989661821A6BFA30031C5D8 /* ViewController.m */, 116 | E989661A21A6BFA30031C5D8 /* Main.storyboard */, 117 | E989661D21A6BFA50031C5D8 /* Assets.xcassets */, 118 | E989661F21A6BFA50031C5D8 /* LaunchScreen.storyboard */, 119 | E989662221A6BFA50031C5D8 /* Info.plist */, 120 | E989662321A6BFA50031C5D8 /* main.m */, 121 | ); 122 | path = JhPageControl; 123 | sourceTree = ""; 124 | }; 125 | E989662C21A6BFA50031C5D8 /* JhPageControlTests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | E989662D21A6BFA50031C5D8 /* JhPageControlTests.m */, 129 | E989662F21A6BFA50031C5D8 /* Info.plist */, 130 | ); 131 | path = JhPageControlTests; 132 | sourceTree = ""; 133 | }; 134 | E989663721A6BFA50031C5D8 /* JhPageControlUITests */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | E989663821A6BFA50031C5D8 /* JhPageControlUITests.m */, 138 | E989663A21A6BFA50031C5D8 /* Info.plist */, 139 | ); 140 | path = JhPageControlUITests; 141 | sourceTree = ""; 142 | }; 143 | E9C0ED6E21A78412009D812D /* screenshots */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | E9C0ED7321A78429009D812D /* 1.gif */, 147 | ); 148 | path = screenshots; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | E989661021A6BFA30031C5D8 /* JhPageControl */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = E989663D21A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControl" */; 157 | buildPhases = ( 158 | E989660D21A6BFA30031C5D8 /* Sources */, 159 | E989660E21A6BFA30031C5D8 /* Frameworks */, 160 | E989660F21A6BFA30031C5D8 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = JhPageControl; 167 | productName = JhPageControl; 168 | productReference = E989661121A6BFA30031C5D8 /* JhPageControl.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | E989662821A6BFA50031C5D8 /* JhPageControlTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = E989664021A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControlTests" */; 174 | buildPhases = ( 175 | E989662521A6BFA50031C5D8 /* Sources */, 176 | E989662621A6BFA50031C5D8 /* Frameworks */, 177 | E989662721A6BFA50031C5D8 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | E989662B21A6BFA50031C5D8 /* PBXTargetDependency */, 183 | ); 184 | name = JhPageControlTests; 185 | productName = JhPageControlTests; 186 | productReference = E989662921A6BFA50031C5D8 /* JhPageControlTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | E989663321A6BFA50031C5D8 /* JhPageControlUITests */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = E989664321A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControlUITests" */; 192 | buildPhases = ( 193 | E989663021A6BFA50031C5D8 /* Sources */, 194 | E989663121A6BFA50031C5D8 /* Frameworks */, 195 | E989663221A6BFA50031C5D8 /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | E989663621A6BFA50031C5D8 /* PBXTargetDependency */, 201 | ); 202 | name = JhPageControlUITests; 203 | productName = JhPageControlUITests; 204 | productReference = E989663421A6BFA50031C5D8 /* JhPageControlUITests.xctest */; 205 | productType = "com.apple.product-type.bundle.ui-testing"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | E989660921A6BFA30031C5D8 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | LastUpgradeCheck = 1010; 214 | ORGANIZATIONNAME = Jh; 215 | TargetAttributes = { 216 | E989661021A6BFA30031C5D8 = { 217 | CreatedOnToolsVersion = 10.1; 218 | }; 219 | E989662821A6BFA50031C5D8 = { 220 | CreatedOnToolsVersion = 10.1; 221 | TestTargetID = E989661021A6BFA30031C5D8; 222 | }; 223 | E989663321A6BFA50031C5D8 = { 224 | CreatedOnToolsVersion = 10.1; 225 | TestTargetID = E989661021A6BFA30031C5D8; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = E989660C21A6BFA30031C5D8 /* Build configuration list for PBXProject "JhPageControl" */; 230 | compatibilityVersion = "Xcode 9.3"; 231 | developmentRegion = en; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = E989660821A6BFA30031C5D8; 238 | productRefGroup = E989661221A6BFA30031C5D8 /* Products */; 239 | projectDirPath = ""; 240 | projectRoot = ""; 241 | targets = ( 242 | E989661021A6BFA30031C5D8 /* JhPageControl */, 243 | E989662821A6BFA50031C5D8 /* JhPageControlTests */, 244 | E989663321A6BFA50031C5D8 /* JhPageControlUITests */, 245 | ); 246 | }; 247 | /* End PBXProject section */ 248 | 249 | /* Begin PBXResourcesBuildPhase section */ 250 | E989660F21A6BFA30031C5D8 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | E989662121A6BFA50031C5D8 /* LaunchScreen.storyboard in Resources */, 255 | E989661E21A6BFA50031C5D8 /* Assets.xcassets in Resources */, 256 | E9C0ED7421A78429009D812D /* 1.gif in Resources */, 257 | E989661C21A6BFA30031C5D8 /* Main.storyboard in Resources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | E989662721A6BFA50031C5D8 /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | E989663221A6BFA50031C5D8 /* Resources */ = { 269 | isa = PBXResourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | /* End PBXResourcesBuildPhase section */ 276 | 277 | /* Begin PBXSourcesBuildPhase section */ 278 | E989660D21A6BFA30031C5D8 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | E989661921A6BFA30031C5D8 /* ViewController.m in Sources */, 283 | E989662421A6BFA50031C5D8 /* main.m in Sources */, 284 | E989664821A6BFC10031C5D8 /* JhPageControl.m in Sources */, 285 | E989661621A6BFA30031C5D8 /* AppDelegate.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | E989662521A6BFA50031C5D8 /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | E989662E21A6BFA50031C5D8 /* JhPageControlTests.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | E989663021A6BFA50031C5D8 /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | E989663921A6BFA50031C5D8 /* JhPageControlUITests.m in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXTargetDependency section */ 308 | E989662B21A6BFA50031C5D8 /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = E989661021A6BFA30031C5D8 /* JhPageControl */; 311 | targetProxy = E989662A21A6BFA50031C5D8 /* PBXContainerItemProxy */; 312 | }; 313 | E989663621A6BFA50031C5D8 /* PBXTargetDependency */ = { 314 | isa = PBXTargetDependency; 315 | target = E989661021A6BFA30031C5D8 /* JhPageControl */; 316 | targetProxy = E989663521A6BFA50031C5D8 /* PBXContainerItemProxy */; 317 | }; 318 | /* End PBXTargetDependency section */ 319 | 320 | /* Begin PBXVariantGroup section */ 321 | E989661A21A6BFA30031C5D8 /* Main.storyboard */ = { 322 | isa = PBXVariantGroup; 323 | children = ( 324 | E989661B21A6BFA30031C5D8 /* Base */, 325 | ); 326 | name = Main.storyboard; 327 | sourceTree = ""; 328 | }; 329 | E989661F21A6BFA50031C5D8 /* LaunchScreen.storyboard */ = { 330 | isa = PBXVariantGroup; 331 | children = ( 332 | E989662021A6BFA50031C5D8 /* Base */, 333 | ); 334 | name = LaunchScreen.storyboard; 335 | sourceTree = ""; 336 | }; 337 | /* End PBXVariantGroup section */ 338 | 339 | /* Begin XCBuildConfiguration section */ 340 | E989663B21A6BFA50031C5D8 /* Debug */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | ALWAYS_SEARCH_USER_PATHS = NO; 344 | CLANG_ANALYZER_NONNULL = YES; 345 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 346 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 347 | CLANG_CXX_LIBRARY = "libc++"; 348 | CLANG_ENABLE_MODULES = YES; 349 | CLANG_ENABLE_OBJC_ARC = YES; 350 | CLANG_ENABLE_OBJC_WEAK = YES; 351 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_COMMA = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 356 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 357 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 358 | CLANG_WARN_EMPTY_BODY = YES; 359 | CLANG_WARN_ENUM_CONVERSION = YES; 360 | CLANG_WARN_INFINITE_RECURSION = YES; 361 | CLANG_WARN_INT_CONVERSION = YES; 362 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 363 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 364 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 365 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 366 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 367 | CLANG_WARN_STRICT_PROTOTYPES = YES; 368 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 369 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 370 | CLANG_WARN_UNREACHABLE_CODE = YES; 371 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 372 | CODE_SIGN_IDENTITY = "iPhone Developer"; 373 | COPY_PHASE_STRIP = NO; 374 | DEBUG_INFORMATION_FORMAT = dwarf; 375 | ENABLE_STRICT_OBJC_MSGSEND = YES; 376 | ENABLE_TESTABILITY = YES; 377 | GCC_C_LANGUAGE_STANDARD = gnu11; 378 | GCC_DYNAMIC_NO_PIC = NO; 379 | GCC_NO_COMMON_BLOCKS = YES; 380 | GCC_OPTIMIZATION_LEVEL = 0; 381 | GCC_PREPROCESSOR_DEFINITIONS = ( 382 | "DEBUG=1", 383 | "$(inherited)", 384 | ); 385 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 386 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 387 | GCC_WARN_UNDECLARED_SELECTOR = YES; 388 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 389 | GCC_WARN_UNUSED_FUNCTION = YES; 390 | GCC_WARN_UNUSED_VARIABLE = YES; 391 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 392 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 393 | MTL_FAST_MATH = YES; 394 | ONLY_ACTIVE_ARCH = YES; 395 | SDKROOT = iphoneos; 396 | }; 397 | name = Debug; 398 | }; 399 | E989663C21A6BFA50031C5D8 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | ALWAYS_SEARCH_USER_PATHS = NO; 403 | CLANG_ANALYZER_NONNULL = YES; 404 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_ENABLE_OBJC_WEAK = YES; 410 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_COMMA = YES; 413 | CLANG_WARN_CONSTANT_CONVERSION = YES; 414 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 415 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 416 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 417 | CLANG_WARN_EMPTY_BODY = YES; 418 | CLANG_WARN_ENUM_CONVERSION = YES; 419 | CLANG_WARN_INFINITE_RECURSION = YES; 420 | CLANG_WARN_INT_CONVERSION = YES; 421 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 422 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 423 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 424 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 425 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 426 | CLANG_WARN_STRICT_PROTOTYPES = YES; 427 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 428 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 429 | CLANG_WARN_UNREACHABLE_CODE = YES; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | CODE_SIGN_IDENTITY = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 434 | ENABLE_NS_ASSERTIONS = NO; 435 | ENABLE_STRICT_OBJC_MSGSEND = YES; 436 | GCC_C_LANGUAGE_STANDARD = gnu11; 437 | GCC_NO_COMMON_BLOCKS = YES; 438 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 439 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 440 | GCC_WARN_UNDECLARED_SELECTOR = YES; 441 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 442 | GCC_WARN_UNUSED_FUNCTION = YES; 443 | GCC_WARN_UNUSED_VARIABLE = YES; 444 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 445 | MTL_ENABLE_DEBUG_INFO = NO; 446 | MTL_FAST_MATH = YES; 447 | SDKROOT = iphoneos; 448 | VALIDATE_PRODUCT = YES; 449 | }; 450 | name = Release; 451 | }; 452 | E989663E21A6BFA50031C5D8 /* Debug */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 456 | CODE_SIGN_STYLE = Automatic; 457 | DEVELOPMENT_TEAM = ""; 458 | INFOPLIST_FILE = JhPageControl/Info.plist; 459 | LD_RUNPATH_SEARCH_PATHS = ( 460 | "$(inherited)", 461 | "@executable_path/Frameworks", 462 | ); 463 | PRODUCT_BUNDLE_IDENTIFIER = com.Jh.JhPageControl; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | TARGETED_DEVICE_FAMILY = "1,2"; 466 | }; 467 | name = Debug; 468 | }; 469 | E989663F21A6BFA50031C5D8 /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 473 | CODE_SIGN_STYLE = Automatic; 474 | DEVELOPMENT_TEAM = ""; 475 | INFOPLIST_FILE = JhPageControl/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "@executable_path/Frameworks", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = com.Jh.JhPageControl; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | TARGETED_DEVICE_FAMILY = "1,2"; 483 | }; 484 | name = Release; 485 | }; 486 | E989664121A6BFA50031C5D8 /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | BUNDLE_LOADER = "$(TEST_HOST)"; 490 | CODE_SIGN_STYLE = Automatic; 491 | DEVELOPMENT_TEAM = 8ZH8KFMR9N; 492 | INFOPLIST_FILE = JhPageControlTests/Info.plist; 493 | LD_RUNPATH_SEARCH_PATHS = ( 494 | "$(inherited)", 495 | "@executable_path/Frameworks", 496 | "@loader_path/Frameworks", 497 | ); 498 | PRODUCT_BUNDLE_IDENTIFIER = com.bjdsst.JhPageControlTests; 499 | PRODUCT_NAME = "$(TARGET_NAME)"; 500 | TARGETED_DEVICE_FAMILY = "1,2"; 501 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JhPageControl.app/JhPageControl"; 502 | }; 503 | name = Debug; 504 | }; 505 | E989664221A6BFA50031C5D8 /* Release */ = { 506 | isa = XCBuildConfiguration; 507 | buildSettings = { 508 | BUNDLE_LOADER = "$(TEST_HOST)"; 509 | CODE_SIGN_STYLE = Automatic; 510 | DEVELOPMENT_TEAM = 8ZH8KFMR9N; 511 | INFOPLIST_FILE = JhPageControlTests/Info.plist; 512 | LD_RUNPATH_SEARCH_PATHS = ( 513 | "$(inherited)", 514 | "@executable_path/Frameworks", 515 | "@loader_path/Frameworks", 516 | ); 517 | PRODUCT_BUNDLE_IDENTIFIER = com.bjdsst.JhPageControlTests; 518 | PRODUCT_NAME = "$(TARGET_NAME)"; 519 | TARGETED_DEVICE_FAMILY = "1,2"; 520 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JhPageControl.app/JhPageControl"; 521 | }; 522 | name = Release; 523 | }; 524 | E989664421A6BFA50031C5D8 /* Debug */ = { 525 | isa = XCBuildConfiguration; 526 | buildSettings = { 527 | CODE_SIGN_STYLE = Automatic; 528 | DEVELOPMENT_TEAM = 8ZH8KFMR9N; 529 | INFOPLIST_FILE = JhPageControlUITests/Info.plist; 530 | LD_RUNPATH_SEARCH_PATHS = ( 531 | "$(inherited)", 532 | "@executable_path/Frameworks", 533 | "@loader_path/Frameworks", 534 | ); 535 | PRODUCT_BUNDLE_IDENTIFIER = com.bjdsst.JhPageControlUITests; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | TARGETED_DEVICE_FAMILY = "1,2"; 538 | TEST_TARGET_NAME = JhPageControl; 539 | }; 540 | name = Debug; 541 | }; 542 | E989664521A6BFA50031C5D8 /* Release */ = { 543 | isa = XCBuildConfiguration; 544 | buildSettings = { 545 | CODE_SIGN_STYLE = Automatic; 546 | DEVELOPMENT_TEAM = 8ZH8KFMR9N; 547 | INFOPLIST_FILE = JhPageControlUITests/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = ( 549 | "$(inherited)", 550 | "@executable_path/Frameworks", 551 | "@loader_path/Frameworks", 552 | ); 553 | PRODUCT_BUNDLE_IDENTIFIER = com.bjdsst.JhPageControlUITests; 554 | PRODUCT_NAME = "$(TARGET_NAME)"; 555 | TARGETED_DEVICE_FAMILY = "1,2"; 556 | TEST_TARGET_NAME = JhPageControl; 557 | }; 558 | name = Release; 559 | }; 560 | /* End XCBuildConfiguration section */ 561 | 562 | /* Begin XCConfigurationList section */ 563 | E989660C21A6BFA30031C5D8 /* Build configuration list for PBXProject "JhPageControl" */ = { 564 | isa = XCConfigurationList; 565 | buildConfigurations = ( 566 | E989663B21A6BFA50031C5D8 /* Debug */, 567 | E989663C21A6BFA50031C5D8 /* Release */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | E989663D21A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControl" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | E989663E21A6BFA50031C5D8 /* Debug */, 576 | E989663F21A6BFA50031C5D8 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | E989664021A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControlTests" */ = { 582 | isa = XCConfigurationList; 583 | buildConfigurations = ( 584 | E989664121A6BFA50031C5D8 /* Debug */, 585 | E989664221A6BFA50031C5D8 /* Release */, 586 | ); 587 | defaultConfigurationIsVisible = 0; 588 | defaultConfigurationName = Release; 589 | }; 590 | E989664321A6BFA50031C5D8 /* Build configuration list for PBXNativeTarget "JhPageControlUITests" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | E989664421A6BFA50031C5D8 /* Debug */, 594 | E989664521A6BFA50031C5D8 /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | /* End XCConfigurationList section */ 600 | }; 601 | rootObject = E989660921A6BFA30031C5D8 /* Project object */; 602 | } 603 | -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/project.xcworkspace/xcuserdata/jh.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/JhPageControl.xcodeproj/project.xcworkspace/xcuserdata/jh.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/project.xcworkspace/xcuserdata/lantongmac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/JhPageControl.xcodeproj/project.xcworkspace/xcuserdata/lantongmac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/xcuserdata/jh.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JhPageControl.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/xcuserdata/lantongmac.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /JhPageControl.xcodeproj/xcuserdata/lantongmac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JhPageControl.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JhPageControl/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/JhPageControl/.DS_Store -------------------------------------------------------------------------------- /JhPageControl/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JhPageControl 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. 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 | -------------------------------------------------------------------------------- /JhPageControl/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JhPageControl 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /JhPageControl/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /JhPageControl/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /JhPageControl/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JhPageControl/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 | -------------------------------------------------------------------------------- /JhPageControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /JhPageControl/JhPageControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // JhPageControl.h 3 | // 4 | // 5 | // Created by Jh on 2018/11/7. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSUInteger, JhControlAlignmentStyle) { 14 | JhControlAlignmentStyleCenter = 0, 15 | JhControlAlignmentStyleLeft, 16 | JhControlAlignmentStyleRight, 17 | }; 18 | 19 | typedef NS_ENUM(NSInteger, JhPageControlStyle) { 20 | /** 默认按照 controlSize 设置的值,如果controlSize未设置 则按照大小为5的小圆点 */ 21 | JhPageControlStyelDefault = 0, 22 | /** 长条样式 */ 23 | JhPageControlStyelRectangle, 24 | /** 圆点 + 长条 样式 */ 25 | JhPageControlStyelDotAndRectangle, 26 | }; 27 | 28 | 29 | @class JhPageControl; 30 | 31 | @protocol JhPageControlDelegate 32 | 33 | - (void)JhPageControlClick:(JhPageControl*)pageControl index:(NSInteger)clickIndex; 34 | 35 | @end 36 | 37 | 38 | @interface JhPageControl : UIControl 39 | 40 | /** 位置 默认居中 */ 41 | @property (nonatomic, assign) JhControlAlignmentStyle Jh_alignmentStyle; 42 | 43 | /** 滚动条样式 默认按照 controlSize 设置的值,如果controlSize未设置 则为大小为5的小圆点 */ 44 | @property (nonatomic, assign) JhPageControlStyle Jh_pageControlStyle; 45 | 46 | @property (nonatomic, assign) NSInteger Jh_numberOfPages; // default is 0 47 | 48 | @property (nonatomic, assign) NSInteger Jh_currentPage; // default is 0. value pinned to 0..numberOfPages-1 49 | 50 | /** 距离初始位置 间距 默认10 */ 51 | @property (nonatomic, assign) CGFloat Jh_marginSpacing; 52 | 53 | /** 间距 默认3 */ 54 | @property (nonatomic, assign) CGFloat Jh_controlSpacing; 55 | 56 | /** 大小 默认(5,5) 如果设置Jh_pageControlStyle,则失效 */ 57 | @property (nonatomic, assign) CGSize Jh_controlSize; 58 | 59 | /** 其他page颜色 */ 60 | @property (nonatomic, strong) UIColor *Jh_otherColor; 61 | 62 | /** 当前page颜色 */ 63 | @property (nonatomic, strong) UIColor *Jh_currentColor; 64 | 65 | /** 设置图片 */ 66 | @property (nonatomic, strong) UIImage *Jh_currentBgImg; 67 | 68 | @property (nonatomic, weak) id delegate; 69 | 70 | /** block 要写在 Jh_currentPage之前,否则第一次的不会触发 */ 71 | @property (nonatomic, copy) void(^JhSelectBlock)(JhPageControl *pageControl,NSInteger clickIndex); 72 | 73 | 74 | @end 75 | 76 | 77 | 78 | 79 | NS_ASSUME_NONNULL_END 80 | -------------------------------------------------------------------------------- /JhPageControl/JhPageControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // JhPageControl.m 3 | // 4 | // 5 | // Created by Jh on 2018/11/7. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import "JhPageControl.h" 10 | 11 | 12 | @interface JhPageControl () 13 | 14 | @end 15 | 16 | 17 | @implementation JhPageControl 18 | 19 | - (instancetype)init { 20 | if (self = [super init]) { 21 | [self initSetUp]; 22 | } 23 | return self; 24 | } 25 | 26 | - (instancetype)initWithFrame:(CGRect)frame { 27 | if (self = [super initWithFrame:frame]) { 28 | [self initSetUp]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)layoutSubviews { 34 | [super layoutSubviews]; 35 | [self createPointView]; 36 | } 37 | 38 | - (void)initSetUp { 39 | self.backgroundColor = [UIColor clearColor]; 40 | _Jh_alignmentStyle = JhControlAlignmentStyleCenter; 41 | _Jh_marginSpacing = 12; 42 | _Jh_numberOfPages = 0; 43 | _Jh_currentPage = 0; 44 | _Jh_controlSize = CGSizeMake(5, 5); 45 | _Jh_controlSpacing = 3; 46 | _Jh_otherColor = [UIColor lightGrayColor]; 47 | _Jh_currentColor = [UIColor orangeColor]; 48 | } 49 | 50 | - (void)setJh_otherColor:(UIColor *)Jh_otherColor { 51 | if (![self isTheSameColor:Jh_otherColor andotherColor:_Jh_otherColor]) { 52 | _Jh_otherColor = Jh_otherColor; 53 | [self createPointView]; 54 | } 55 | } 56 | 57 | - (void)setJh_currentColor:(UIColor *)Jh_currentColor { 58 | if (![self isTheSameColor:Jh_currentColor andotherColor:_Jh_currentColor]) { 59 | _Jh_currentColor = Jh_currentColor; 60 | [self createPointView]; 61 | } 62 | } 63 | 64 | - (void)setJh_controlSize:(CGSize)Jh_controlSize { 65 | if (Jh_controlSize.width != _Jh_controlSize.width || Jh_controlSize.height != _Jh_controlSize.height) { 66 | _Jh_controlSize = Jh_controlSize; 67 | [self createPointView]; 68 | } 69 | } 70 | 71 | - (void)setJh_controlSpacing:(CGFloat)Jh_controlSpacing { 72 | if(_Jh_controlSpacing != Jh_controlSpacing){ 73 | _Jh_controlSpacing = Jh_controlSpacing; 74 | [self createPointView]; 75 | } 76 | } 77 | 78 | - (void)setJh_currentBgImg:(UIImage *)Jh_currentBgImg { 79 | if (_Jh_currentBgImg != Jh_currentBgImg) { 80 | _Jh_currentBgImg = Jh_currentBgImg; 81 | [self createPointView]; 82 | } 83 | } 84 | 85 | - (void)setJh_numberOfPages:(NSInteger)Jh_numberOfPages { 86 | if (_Jh_numberOfPages == Jh_numberOfPages) return; 87 | _Jh_numberOfPages = Jh_numberOfPages; 88 | [self createPointView]; 89 | } 90 | 91 | - (void)setJh_alignmentStyle:(JhControlAlignmentStyle)Jh_alignmentStyle { 92 | if (_Jh_alignmentStyle == Jh_alignmentStyle) return; 93 | _Jh_alignmentStyle = Jh_alignmentStyle; 94 | [self createPointView]; 95 | } 96 | 97 | - (void)setJh_marginSpacing:(CGFloat)Jh_marginSpacing { 98 | if (_Jh_marginSpacing == Jh_marginSpacing) return; 99 | _Jh_marginSpacing = Jh_marginSpacing; 100 | [self createPointView]; 101 | } 102 | 103 | - (void)setJh_currentPage:(NSInteger)Jh_currentPage { 104 | if ([self.delegate respondsToSelector:@selector(JhPageControlClick:index:)]) { 105 | [self.delegate JhPageControlClick:self index:Jh_currentPage]; 106 | } 107 | if (self.JhSelectBlock) { 108 | self.JhSelectBlock(self, Jh_currentPage); 109 | } 110 | if (_Jh_currentPage == Jh_currentPage) return; 111 | [self exchangeCurrentView:_Jh_currentPage new:Jh_currentPage]; 112 | _Jh_currentPage = Jh_currentPage; 113 | } 114 | 115 | - (void)clearView { 116 | [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 117 | } 118 | 119 | - (void)setJh_pageControlStyle:(JhPageControlStyle)Jh_pageControlStyle { 120 | if (_Jh_pageControlStyle == Jh_pageControlStyle) return; 121 | _Jh_pageControlStyle = Jh_pageControlStyle; 122 | [self createPointView]; 123 | } 124 | 125 | #pragma mark - 根据样式创建点 126 | - (void)createPointView { 127 | [self clearView]; 128 | if (_Jh_numberOfPages <= 0) return; 129 | 130 | switch (_Jh_pageControlStyle) { 131 | case JhPageControlStyelDefault: 132 | { 133 | [self CreatDotWithSize:_Jh_controlSize]; 134 | } 135 | break; 136 | case JhPageControlStyelRectangle: 137 | { 138 | [self CreatDotWithSize:CGSizeMake(15, 2)]; 139 | } 140 | break; 141 | case JhPageControlStyelDotAndRectangle: 142 | { 143 | [self CreatDotWithSize:CGSizeMake(15, 4) withOtherDotSize:CGSizeMake(4, 4)]; 144 | } 145 | break; 146 | default: 147 | break; 148 | } 149 | } 150 | 151 | 152 | #pragma mark - 默认样式创建点 153 | - (void)CreatDotWithSize:(CGSize)DotSize { 154 | //居中控件 155 | CGFloat startX = 0; 156 | CGFloat startY = 0; 157 | CGFloat controlSizeW = DotSize.width; 158 | CGFloat controlSizeH = DotSize.height; 159 | CGFloat mainWidth = _Jh_numberOfPages * (controlSizeW + _Jh_controlSpacing); 160 | 161 | if (self.frame.size.width < mainWidth) { 162 | startX = 0; 163 | } else { 164 | if (_Jh_alignmentStyle == JhControlAlignmentStyleLeft && self.frame.size.width - _Jh_marginSpacing * 2 > mainWidth) { 165 | startX = _Jh_marginSpacing; 166 | } else if (_Jh_alignmentStyle == JhControlAlignmentStyleRight && self.frame.size.width - _Jh_marginSpacing * 2 > mainWidth) { 167 | startX = (self.frame.size.width - mainWidth) - _Jh_marginSpacing; 168 | } else { 169 | startX = (self.frame.size.width - mainWidth) / 2; 170 | } 171 | } 172 | if (self.frame.size.height < controlSizeH) { 173 | startY = 0; 174 | } else { 175 | startY = (self.frame.size.height - controlSizeH) / 2; 176 | } 177 | //动态创建点 178 | for (int page = 0; page < _Jh_numberOfPages; page++) { 179 | if (page ==_Jh_currentPage) { 180 | UIView *currPointView = [[UIView alloc]initWithFrame:CGRectMake(startX, startY, controlSizeW, controlSizeH)]; 181 | currPointView.layer.cornerRadius = controlSizeH/2; 182 | currPointView.tag = page + 1000; 183 | currPointView.backgroundColor = _Jh_currentColor; 184 | currPointView.userInteractionEnabled = YES; 185 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAction:)]; 186 | [currPointView addGestureRecognizer:tapGesture]; 187 | [self addSubview:currPointView]; 188 | startX = CGRectGetMaxX(currPointView.frame) + _Jh_controlSpacing; 189 | if(_Jh_currentBgImg){ 190 | currPointView.backgroundColor = [UIColor clearColor]; 191 | UIImageView *currBgImg = [UIImageView new]; 192 | currBgImg.tag = 1234; 193 | currBgImg.frame = CGRectMake(0, 0, currPointView.frame.size.width, currPointView.frame.size.height); 194 | currBgImg.image = _Jh_currentBgImg; 195 | [currPointView addSubview:currBgImg]; 196 | } 197 | } else { 198 | UIView *otherPointView = [[UIView alloc]initWithFrame:CGRectMake(startX, startY, controlSizeW, controlSizeH)]; 199 | otherPointView.backgroundColor = _Jh_otherColor; 200 | otherPointView.tag = page + 1000; 201 | otherPointView.layer.cornerRadius = controlSizeH / 2; 202 | otherPointView.userInteractionEnabled = YES; 203 | 204 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAction:)]; 205 | [otherPointView addGestureRecognizer:tapGesture]; 206 | [self addSubview:otherPointView]; 207 | startX = CGRectGetMaxX(otherPointView.frame) + _Jh_controlSpacing; 208 | } 209 | } 210 | } 211 | 212 | #pragma mark - 创建 圆点 + 长条形 样式 213 | - (void)CreatDotWithSize:(CGSize)currentDotSize withOtherDotSize:(CGSize)otherDotSize { 214 | //居中控件 215 | CGFloat startX = 0; 216 | CGFloat startY = 0; 217 | CGFloat currentDotSizeW = currentDotSize.width; 218 | CGFloat currentDotSizeH = currentDotSize.height; 219 | CGFloat otherDotSizeW = otherDotSize.width; 220 | CGFloat otherDotSizeH = otherDotSize.height; 221 | 222 | CGFloat mainWidth = currentDotSizeW + (_Jh_numberOfPages - 1) * (otherDotSizeW + _Jh_controlSpacing); 223 | 224 | if (self.frame.size.width < mainWidth) { 225 | startX = 0; 226 | } else { 227 | if (_Jh_alignmentStyle == JhControlAlignmentStyleLeft && self.frame.size.width - _Jh_marginSpacing * 2 > mainWidth) { 228 | startX = _Jh_marginSpacing; 229 | } else if (_Jh_alignmentStyle == JhControlAlignmentStyleRight && self.frame.size.width - _Jh_marginSpacing * 2 > mainWidth) { 230 | startX = (self.frame.size.width - mainWidth) - _Jh_marginSpacing; 231 | } else { 232 | startX = (self.frame.size.width - mainWidth) / 2; 233 | } 234 | } 235 | if (self.frame.size.height < otherDotSizeH) { 236 | startY = 0; 237 | } else { 238 | startY = (self.frame.size.height - otherDotSizeH) / 2; 239 | } 240 | //动态创建点 241 | for (int page = 0; page < _Jh_numberOfPages; page++) { 242 | if (page == _Jh_currentPage) { 243 | UIView *currPointView = [[UIView alloc]initWithFrame:CGRectMake(startX, startY, currentDotSizeW, currentDotSizeH)]; 244 | currPointView.layer.cornerRadius = currentDotSizeH / 2; 245 | currPointView.tag = page + 1000; 246 | currPointView.backgroundColor = _Jh_currentColor; 247 | currPointView.userInteractionEnabled = YES; 248 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAction:)]; 249 | [currPointView addGestureRecognizer:tapGesture]; 250 | [self addSubview:currPointView]; 251 | startX = CGRectGetMaxX(currPointView.frame) + _Jh_controlSpacing; 252 | if (_Jh_currentBgImg) { 253 | currPointView.backgroundColor = [UIColor clearColor]; 254 | UIImageView *currBgImg = [UIImageView new]; 255 | currBgImg.tag = 1234; 256 | currBgImg.frame = CGRectMake(0, 0, currPointView.frame.size.width, currPointView.frame.size.height); 257 | currBgImg.image = _Jh_currentBgImg; 258 | [currPointView addSubview:currBgImg]; 259 | } 260 | } else { 261 | UIView *otherPointView = [[UIView alloc]initWithFrame:CGRectMake(startX, startY, otherDotSizeW, otherDotSizeH)]; 262 | otherPointView.backgroundColor = _Jh_otherColor; 263 | otherPointView.tag = page + 1000; 264 | otherPointView.layer.cornerRadius = otherDotSizeH/2; 265 | otherPointView.userInteractionEnabled = YES; 266 | 267 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAction:)]; 268 | [otherPointView addGestureRecognizer:tapGesture]; 269 | [self addSubview:otherPointView]; 270 | startX = CGRectGetMaxX(otherPointView.frame) + _Jh_controlSpacing; 271 | } 272 | } 273 | } 274 | 275 | - (void)clickAction:(UITapGestureRecognizer*)recognizer { 276 | NSInteger index = recognizer.view.tag - 1000; 277 | [self setJh_currentPage:index]; 278 | } 279 | 280 | - (BOOL)isTheSameColor:(UIColor*)color1 andotherColor:(UIColor*)color2 { 281 | return CGColorEqualToColor(color1.CGColor, color2.CGColor); 282 | } 283 | 284 | //切换当前的点 285 | - (void)exchangeCurrentView:(NSInteger)old new:(NSInteger)new { 286 | UIView *oldSelect = [self viewWithTag:1000+old]; 287 | CGRect mpSelect = oldSelect.frame; 288 | 289 | UIView *newSeltect = [self viewWithTag:1000+new]; 290 | CGRect newTemp = newSeltect.frame; 291 | 292 | if (_Jh_currentBgImg) { 293 | UIView *imgview = [oldSelect viewWithTag:1234]; 294 | [imgview removeFromSuperview]; 295 | 296 | newSeltect.backgroundColor = [UIColor clearColor]; 297 | UIImageView *currBgImg = [UIImageView new]; 298 | currBgImg.tag = 1234; 299 | currBgImg.frame = CGRectMake(0, 0, mpSelect.size.width, mpSelect.size.height); 300 | currBgImg.image = _Jh_currentBgImg; 301 | [newSeltect addSubview:currBgImg]; 302 | } 303 | 304 | oldSelect.backgroundColor = _Jh_otherColor; 305 | newSeltect.backgroundColor = _Jh_currentColor; 306 | 307 | [UIView animateWithDuration:0.3 animations:^{ 308 | CGFloat lx = mpSelect.origin.x; 309 | CGFloat pageW = self.Jh_controlSize.width; 310 | CGFloat pageH = self.Jh_controlSize.height; 311 | if(new < old) 312 | lx += pageW; 313 | oldSelect.frame = CGRectMake(lx, mpSelect.origin.y, pageW, pageH); 314 | 315 | CGFloat mx = newTemp.origin.x; 316 | if(new > old) 317 | mx -= pageW; 318 | newSeltect.frame = CGRectMake(mx, newTemp.origin.y, pageW*2, pageH); 319 | 320 | // 左边的时候到右边 越过点击 321 | if (new-old>1) { 322 | for (NSInteger t = old+1; t < new; t++) { 323 | UIView *ms = [self viewWithTag:1000+t]; 324 | ms.frame = CGRectMake(ms.frame.origin.x-pageW, ms.frame.origin.y, pageW, pageH); 325 | } 326 | } 327 | // 右边选中到左边的时候 越过点击 328 | if (new-old<-1) { 329 | for (NSInteger t = new+1; t < old; t++) { 330 | UIView *ms = [self viewWithTag:1000+t]; 331 | ms.frame = CGRectMake(ms.frame.origin.x+pageW, ms.frame.origin.y, pageW, pageH); 332 | } 333 | } 334 | }]; 335 | } 336 | 337 | 338 | @end 339 | -------------------------------------------------------------------------------- /JhPageControl/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JhPageControl 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JhPageControl/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JhPageControl 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JhPageControl.h" 11 | 12 | #define Kwidth [UIScreen mainScreen].bounds.size.width 13 | #define Kheight [UIScreen mainScreen].bounds.size.height 14 | 15 | #define JhColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] 16 | #define JhRandomColor JhColor(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255)) 17 | 18 | #define kMaxPage 6 19 | 20 | @interface ViewController () 21 | 22 | @property (nonatomic, strong) JhPageControl *pageControl; 23 | 24 | @property (nonatomic, strong) JhPageControl *pageControl2; 25 | 26 | @property (nonatomic, strong) JhPageControl *pageControl3; 27 | 28 | @end 29 | 30 | @implementation ViewController 31 | 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | [self pageControl]; 37 | [self pageControl2]; 38 | [self pageControl3]; 39 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(OnClick)]; 40 | [self.view addGestureRecognizer:tapGesture]; 41 | 42 | //block 要写在 Jh_currentPage之前,否则第一次的不会触发 43 | self.pageControl.JhSelectBlock = ^(JhPageControl * _Nonnull pageControl, NSInteger clickIndex) { 44 | NSLog(@"pageControl1 block clickIndex %zd ",clickIndex); 45 | }; 46 | self.pageControl2.JhSelectBlock = ^(JhPageControl * _Nonnull pageControl, NSInteger clickIndex) { 47 | NSLog(@"pageControl2 block clickIndex %zd ",clickIndex); 48 | }; 49 | } 50 | 51 | - (void)OnClick { 52 | _pageControl.Jh_currentPage ++; 53 | _pageControl2.Jh_currentPage ++; 54 | _pageControl3.Jh_currentPage ++; 55 | if (_pageControl.Jh_currentPage == kMaxPage) { 56 | _pageControl.Jh_currentPage = 0; 57 | } 58 | if (_pageControl2.Jh_currentPage == kMaxPage) { 59 | _pageControl2.Jh_currentPage = 0; 60 | } 61 | if (_pageControl3.Jh_currentPage == kMaxPage) { 62 | _pageControl3.Jh_currentPage = 0; 63 | } 64 | 65 | } 66 | 67 | #pragma mark - JhPageControlDelegate 68 | - (void)JhPageControlClick:(JhPageControl*)pageControl index:(NSInteger)clickIndex { 69 | NSLog(@" clickIndex %zd ",clickIndex); 70 | } 71 | 72 | - (JhPageControl *)pageControl { 73 | if (!_pageControl) { 74 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 75 | pageControl.delegate = self; 76 | CGFloat pageControl_X = 0; 77 | CGFloat pageControl_Y = 100; 78 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 79 | pageControl.Jh_numberOfPages = kMaxPage; 80 | pageControl.Jh_currentPage = 1; 81 | pageControl.Jh_otherColor = JhRandomColor; 82 | pageControl.Jh_currentColor = JhRandomColor; 83 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleLeft; //设置对齐方式 84 | pageControl.Jh_controlSpacing = 3.0; 85 | pageControl.Jh_marginSpacing = 10; //距离初始位置 间距 默认10 86 | pageControl.Jh_controlSize = CGSizeMake(5, 5);//如果设置Jh_pageControlStyle,则失效 87 | _pageControl = pageControl; 88 | [self.view addSubview:self.pageControl]; 89 | } 90 | return _pageControl; 91 | } 92 | 93 | - (JhPageControl *)pageControl2 { 94 | if (!_pageControl2) { 95 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 96 | pageControl.delegate = self; 97 | CGFloat pageControl_X = 0; 98 | CGFloat pageControl_Y = 200; 99 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 100 | pageControl.Jh_numberOfPages = kMaxPage; 101 | pageControl.Jh_currentPage = 1; 102 | pageControl.Jh_otherColor = JhRandomColor; 103 | pageControl.Jh_currentColor = JhRandomColor; 104 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleCenter; //设置对齐方式 105 | pageControl.Jh_controlSpacing = 5.0; //间距 106 | pageControl.Jh_marginSpacing = 0; //距离初始位置 间距 默认10 107 | pageControl.Jh_pageControlStyle = JhPageControlStyelDotAndRectangle; //圆点 + 长条 样式 108 | // pageControl.Jh_controlSize = CGSizeMake(15, 2);//如果设置Jh_pageControlStyle,则失效 109 | _pageControl2 = pageControl; 110 | [self.view addSubview:self.pageControl2]; 111 | } 112 | return _pageControl2; 113 | } 114 | 115 | - (JhPageControl *)pageControl3 { 116 | if (!_pageControl3) { 117 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 118 | pageControl.delegate = self; 119 | pageControl.JhSelectBlock = ^(JhPageControl * _Nonnull pageControl, NSInteger clickIndex) { 120 | NSLog(@"pageControl3 block clickIndex %zd ",clickIndex); 121 | }; 122 | CGFloat pageControl_X = 0; 123 | CGFloat pageControl_Y = 300; 124 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 125 | pageControl.Jh_numberOfPages = kMaxPage; 126 | pageControl.Jh_currentPage = 1; 127 | pageControl.Jh_otherColor = JhRandomColor; 128 | pageControl.Jh_currentColor = JhRandomColor; 129 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleRight; //设置对齐方式 130 | pageControl.Jh_controlSpacing = 3.0; //间距 131 | pageControl.Jh_marginSpacing = 10; //距离初始位置 间距 默认10 132 | pageControl.Jh_pageControlStyle = JhPageControlStyelRectangle;//长条样式 133 | _pageControl3 = pageControl; 134 | [self.view addSubview:self.pageControl3]; 135 | } 136 | return _pageControl3; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /JhPageControl/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JhPageControl 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. 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 | -------------------------------------------------------------------------------- /JhPageControl/screenshots/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/JhPageControl/screenshots/.DS_Store -------------------------------------------------------------------------------- /JhPageControl/screenshots/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iotjin/JhPageControl/1dafae6b31c676d022b07d810d840471d7b45aaf/JhPageControl/screenshots/1.gif -------------------------------------------------------------------------------- /JhPageControlTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JhPageControlTests/JhPageControlTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JhPageControlTests.m 3 | // JhPageControlTests 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JhPageControlTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JhPageControlTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /JhPageControlUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JhPageControlUITests/JhPageControlUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JhPageControlUITests.m 3 | // JhPageControlUITests 4 | // 5 | // Created by Jh on 2018/11/22. 6 | // Copyright © 2018 Jh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JhPageControlUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JhPageControlUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 24 | [[[XCUIApplication alloc] init] launch]; 25 | 26 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 27 | } 28 | 29 | - (void)tearDown { 30 | // Put teardown code here. This method is called after the invocation of each test method in the class. 31 | } 32 | 33 | - (void)testExample { 34 | // Use recording to get started writing UI tests. 35 | // Use XCTAssert and related functions to verify your tests produce the correct results. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JhPageControl 2 | 3 | JhPageControl - 多种样式pageControl(小圆点,长条,小圆点+长条),可自定义位置(左中右)和大小 4 | 5 | ![](https://raw.githubusercontent.com/iotjin/JhPageControl/master/JhPageControl/screenshots/1.gif)
6 | 7 | ## Examples 8 | 9 | * Demo1 10 | 11 | ```objc 12 | @property (nonatomic, strong) JhPageControl *pageControl; 13 | 14 | - (JhPageControl *)pageControl { 15 | if (!_pageControl) { 16 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 17 | pageControl.delegate = self; 18 | CGFloat pageControl_X = 0; 19 | CGFloat pageControl_Y = 100; 20 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 21 | pageControl.Jh_numberOfPages = kMaxPage; 22 | pageControl.Jh_currentPage = 1; 23 | pageControl.Jh_otherColor = JhRandomColor; 24 | pageControl.Jh_currentColor = JhRandomColor; 25 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleLeft; //设置对齐方式 26 | pageControl.Jh_controlSpacing = 3.0; 27 | pageControl.Jh_marginSpacing = 10; //距离初始位置 间距 默认10 28 | pageControl.Jh_controlSize = CGSizeMake(5, 5);//如果设置Jh_pageControlStyle,则失效 29 | _pageControl = pageControl; 30 | [self.view addSubview:self.pageControl]; 31 | } 32 | return _pageControl; 33 | } 34 | 35 | [self pageControl]; 36 | ``` 37 | * Demo2 38 | 39 | ```objc 40 | @property (nonatomic, strong) JhPageControl *pageControl2; 41 | 42 | - (JhPageControl *)pageControl2 { 43 | if (!_pageControl2) { 44 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 45 | pageControl.delegate = self; 46 | CGFloat pageControl_X = 0; 47 | CGFloat pageControl_Y = 200; 48 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 49 | pageControl.Jh_numberOfPages = kMaxPage; 50 | pageControl.Jh_currentPage = 1; 51 | pageControl.Jh_otherColor = JhRandomColor; 52 | pageControl.Jh_currentColor = JhRandomColor; 53 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleCenter; //设置对齐方式 54 | pageControl.Jh_controlSpacing = 5.0; //间距 55 | pageControl.Jh_marginSpacing = 0; //距离初始位置 间距 默认10 56 | pageControl.Jh_pageControlStyle = JhPageControlStyelDotAndRectangle; //圆点 + 长条 样式 57 | // pageControl.Jh_controlSize = CGSizeMake(15, 2);//如果设置Jh_pageControlStyle,则失效 58 | _pageControl2 = pageControl; 59 | [self.view addSubview:self.pageControl2]; 60 | } 61 | return _pageControl2; 62 | } 63 | 64 | [self pageControl2]; 65 | ``` 66 | * Demo3 67 | 68 | ```objc 69 | @property (nonatomic, strong) JhPageControl *pageControl3; 70 | 71 | - (JhPageControl *)pageControl3 { 72 | if (!_pageControl3) { 73 | JhPageControl *pageControl = [[JhPageControl alloc] init]; 74 | pageControl.delegate = self; 75 | pageControl.JhSelectBlock = ^(JhPageControl * _Nonnull pageControl, NSInteger clickIndex) { 76 | NSLog(@"pageControl3 block clickIndex %zd ",clickIndex); 77 | }; 78 | CGFloat pageControl_X = 0; 79 | CGFloat pageControl_Y = 300; 80 | pageControl.frame = CGRectMake(pageControl_X, pageControl_Y, Kwidth, 15); 81 | pageControl.Jh_numberOfPages = kMaxPage; 82 | pageControl.Jh_currentPage = 1; 83 | pageControl.Jh_otherColor = JhRandomColor; 84 | pageControl.Jh_currentColor = JhRandomColor; 85 | pageControl.Jh_alignmentStyle = JhControlAlignmentStyleRight; //设置对齐方式 86 | pageControl.Jh_controlSpacing = 3.0; //间距 87 | pageControl.Jh_marginSpacing = 10; //距离初始位置 间距 默认10 88 | pageControl.Jh_pageControlStyle = JhPageControlStyelRectangle;//长条样式 89 | _pageControl3 = pageControl; 90 | [self.view addSubview:self.pageControl3]; 91 | } 92 | return _pageControl3; 93 | } 94 | 95 | 96 | [self pageControl3]; 97 | ``` 98 | * JhPageControlDelegate 99 | 100 | ```objc 101 | #pragma mark - JhPageControlDelegate 102 | - (void)JhPageControlClick:(JhPageControl*)pageControl index:(NSInteger)clickIndex { 103 | NSLog(@" clickIndex %zd ",clickIndex); 104 | } 105 | ``` 106 | --------------------------------------------------------------------------------