├── JCPullToSelect-master ├── JCPullToSelect-master.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── mac.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── mac.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── JCPullToSelect-master.xcscheme │ │ └── xcschememanagement.plist ├── JCPullToSelect-master │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── jc_down_normal.imageset │ │ │ ├── Contents.json │ │ │ └── jc_down_normal@2x.png │ │ ├── jc_down_selected.imageset │ │ │ ├── Contents.json │ │ │ └── jc_down_selected@2x.png │ │ ├── jc_refresh_normal.imageset │ │ │ ├── Contents.json │ │ │ └── jc_refresh_normal@2x.png │ │ ├── jc_refresh_selected.imageset │ │ │ ├── Contents.json │ │ │ └── jc_refresh_selected@2x.png │ │ ├── jc_up_normal.imageset │ │ │ ├── Contents.json │ │ │ └── jc_up_normal@2x.png │ │ └── jc_up_selected.imageset │ │ │ ├── Contents.json │ │ │ └── jc_up_selected@2x.png │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── JCCollectionViewController.h │ ├── JCCollectionViewController.m │ ├── JCPullToSelect │ │ ├── JCBallLayer.h │ │ ├── JCBallLayer.m │ │ ├── JCFooter.h │ │ ├── JCFooter.m │ │ ├── JCHeader.h │ │ ├── JCHeader.m │ │ ├── JCPullToSelect.bundle │ │ │ ├── jc_refresh_normal@2x.png │ │ │ ├── jc_refresh_selected@2x.png │ │ │ └── jc_refreshing@2x.png │ │ ├── JCPullToSelect.h │ │ ├── UIScrollView+JCPullToSelect.h │ │ └── UIScrollView+JCPullToSelect.m │ ├── JCTableViewController.h │ ├── JCTableViewController.m │ ├── JCWebViewController.h │ ├── JCWebViewController.m │ ├── ViewController.h │ ├── ViewController.m │ ├── html │ │ ├── 1.html │ │ └── 2.html │ └── main.m ├── JCPullToSelect-masterTests │ ├── Info.plist │ └── JCPullToSelect_masterTests.m └── JCPullToSelect-masterUITests │ ├── Info.plist │ └── JCPullToSelect_masterUITests.m ├── JCPullToSelect.podspec ├── JCPullToSelect ├── JCBallLayer.h ├── JCBallLayer.m ├── JCFooter.h ├── JCFooter.m ├── JCHeader.h ├── JCHeader.m ├── JCPullToSelect.bundle │ ├── jc_refresh_normal@2x.png │ ├── jc_refresh_selected@2x.png │ └── jc_refreshing@2x.png ├── JCPullToSelect.h ├── UIScrollView+JCPullToSelect.h └── UIScrollView+JCPullToSelect.m ├── LICENSE └── README.md /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0436326B1BF49B9C00340587 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0436326A1BF49B9C00340587 /* main.m */; }; 11 | 0436326E1BF49B9C00340587 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0436326D1BF49B9C00340587 /* AppDelegate.m */; }; 12 | 043632711BF49B9C00340587 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 043632701BF49B9C00340587 /* ViewController.m */; }; 13 | 043632761BF49B9C00340587 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 043632751BF49B9C00340587 /* Assets.xcassets */; }; 14 | 043632791BF49B9C00340587 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 043632771BF49B9C00340587 /* LaunchScreen.storyboard */; }; 15 | 043632841BF49B9C00340587 /* JCPullToSelect_masterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 043632831BF49B9C00340587 /* JCPullToSelect_masterTests.m */; }; 16 | 0436328F1BF49B9C00340587 /* JCPullToSelect_masterUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0436328E1BF49B9C00340587 /* JCPullToSelect_masterUITests.m */; }; 17 | 0436329F1BF49BCD00340587 /* JCHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 0436329E1BF49BCD00340587 /* JCHeader.m */; settings = {ASSET_TAGS = (); }; }; 18 | 043632A21BF49BE500340587 /* JCBallLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 043632A11BF49BE500340587 /* JCBallLayer.m */; settings = {ASSET_TAGS = (); }; }; 19 | 043632A51BF49DBE00340587 /* UIScrollView+JCPullToSelect.m in Sources */ = {isa = PBXBuildFile; fileRef = 043632A41BF49DBE00340587 /* UIScrollView+JCPullToSelect.m */; settings = {ASSET_TAGS = (); }; }; 20 | 049716391BF5E97F00C31B48 /* JCTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 049716381BF5E97F00C31B48 /* JCTableViewController.m */; settings = {ASSET_TAGS = (); }; }; 21 | 0497163C1BF5EB8E00C31B48 /* JCWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0497163B1BF5EB8E00C31B48 /* JCWebViewController.m */; settings = {ASSET_TAGS = (); }; }; 22 | 049716451BF5F2B800C31B48 /* 2.html in Resources */ = {isa = PBXBuildFile; fileRef = 049716441BF5F2B800C31B48 /* 2.html */; settings = {ASSET_TAGS = (); }; }; 23 | 04D5142D1BF5B47A0036ACBD /* JCPullToSelect.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04D5142C1BF5B47A0036ACBD /* JCPullToSelect.bundle */; settings = {ASSET_TAGS = (); }; }; 24 | 04D8EF551BF9B10900957047 /* JCCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D8EF541BF9B10900957047 /* JCCollectionViewController.m */; settings = {ASSET_TAGS = (); }; }; 25 | 04D8EF571BF9B82A00957047 /* 1.html in Resources */ = {isa = PBXBuildFile; fileRef = 04D8EF561BF9B82A00957047 /* 1.html */; settings = {ASSET_TAGS = (); }; }; 26 | 04D8EF5A1BF9C46700957047 /* JCFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D8EF591BF9C46700957047 /* JCFooter.m */; settings = {ASSET_TAGS = (); }; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 043632801BF49B9C00340587 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 0436325E1BF49B9C00340587 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 043632651BF49B9C00340587; 35 | remoteInfo = "JCPullToSelect-master"; 36 | }; 37 | 0436328B1BF49B9C00340587 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = 0436325E1BF49B9C00340587 /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = 043632651BF49B9C00340587; 42 | remoteInfo = "JCPullToSelect-master"; 43 | }; 44 | /* End PBXContainerItemProxy section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | 043632661BF49B9C00340587 /* JCPullToSelect-master.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "JCPullToSelect-master.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 0436326A1BF49B9C00340587 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 0436326C1BF49B9C00340587 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 0436326D1BF49B9C00340587 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | 0436326F1BF49B9C00340587 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | 043632701BF49B9C00340587 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | 043632751BF49B9C00340587 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 043632781BF49B9C00340587 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 0436327A1BF49B9C00340587 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 0436327F1BF49B9C00340587 /* JCPullToSelect-masterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "JCPullToSelect-masterTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 043632831BF49B9C00340587 /* JCPullToSelect_masterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JCPullToSelect_masterTests.m; sourceTree = ""; }; 58 | 043632851BF49B9C00340587 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 0436328A1BF49B9C00340587 /* JCPullToSelect-masterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "JCPullToSelect-masterUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 0436328E1BF49B9C00340587 /* JCPullToSelect_masterUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JCPullToSelect_masterUITests.m; sourceTree = ""; }; 61 | 043632901BF49B9C00340587 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | 0436329D1BF49BCD00340587 /* JCHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCHeader.h; sourceTree = ""; }; 63 | 0436329E1BF49BCD00340587 /* JCHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCHeader.m; sourceTree = ""; }; 64 | 043632A01BF49BE500340587 /* JCBallLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCBallLayer.h; sourceTree = ""; }; 65 | 043632A11BF49BE500340587 /* JCBallLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCBallLayer.m; sourceTree = ""; }; 66 | 043632A31BF49DBE00340587 /* UIScrollView+JCPullToSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+JCPullToSelect.h"; sourceTree = ""; }; 67 | 043632A41BF49DBE00340587 /* UIScrollView+JCPullToSelect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+JCPullToSelect.m"; sourceTree = ""; }; 68 | 043632A61BF49E8900340587 /* JCPullToSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCPullToSelect.h; sourceTree = ""; }; 69 | 049716371BF5E97F00C31B48 /* JCTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCTableViewController.h; sourceTree = ""; }; 70 | 049716381BF5E97F00C31B48 /* JCTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCTableViewController.m; sourceTree = ""; }; 71 | 0497163A1BF5EB8D00C31B48 /* JCWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCWebViewController.h; sourceTree = ""; }; 72 | 0497163B1BF5EB8E00C31B48 /* JCWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCWebViewController.m; sourceTree = ""; }; 73 | 049716441BF5F2B800C31B48 /* 2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = 2.html; sourceTree = ""; }; 74 | 04D5142C1BF5B47A0036ACBD /* JCPullToSelect.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = JCPullToSelect.bundle; sourceTree = ""; }; 75 | 04D8EF531BF9B10900957047 /* JCCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCCollectionViewController.h; sourceTree = ""; }; 76 | 04D8EF541BF9B10900957047 /* JCCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCCollectionViewController.m; sourceTree = ""; }; 77 | 04D8EF561BF9B82A00957047 /* 1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = 1.html; sourceTree = ""; }; 78 | 04D8EF581BF9C46700957047 /* JCFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCFooter.h; sourceTree = ""; }; 79 | 04D8EF591BF9C46700957047 /* JCFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCFooter.m; sourceTree = ""; }; 80 | /* End PBXFileReference section */ 81 | 82 | /* Begin PBXFrameworksBuildPhase section */ 83 | 043632631BF49B9C00340587 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | 0436327C1BF49B9C00340587 /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | 043632871BF49B9C00340587 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | 0436325D1BF49B9C00340587 = { 108 | isa = PBXGroup; 109 | children = ( 110 | 043632681BF49B9C00340587 /* JCPullToSelect-master */, 111 | 043632821BF49B9C00340587 /* JCPullToSelect-masterTests */, 112 | 0436328D1BF49B9C00340587 /* JCPullToSelect-masterUITests */, 113 | 043632671BF49B9C00340587 /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | 043632671BF49B9C00340587 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 043632661BF49B9C00340587 /* JCPullToSelect-master.app */, 121 | 0436327F1BF49B9C00340587 /* JCPullToSelect-masterTests.xctest */, 122 | 0436328A1BF49B9C00340587 /* JCPullToSelect-masterUITests.xctest */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | 043632681BF49B9C00340587 /* JCPullToSelect-master */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 0497163F1BF5F18F00C31B48 /* html */, 131 | 0436329C1BF49BB000340587 /* JCPullToSelect */, 132 | 0436326C1BF49B9C00340587 /* AppDelegate.h */, 133 | 0436326D1BF49B9C00340587 /* AppDelegate.m */, 134 | 0436326F1BF49B9C00340587 /* ViewController.h */, 135 | 043632701BF49B9C00340587 /* ViewController.m */, 136 | 049716371BF5E97F00C31B48 /* JCTableViewController.h */, 137 | 049716381BF5E97F00C31B48 /* JCTableViewController.m */, 138 | 04D8EF531BF9B10900957047 /* JCCollectionViewController.h */, 139 | 04D8EF541BF9B10900957047 /* JCCollectionViewController.m */, 140 | 0497163A1BF5EB8D00C31B48 /* JCWebViewController.h */, 141 | 0497163B1BF5EB8E00C31B48 /* JCWebViewController.m */, 142 | 043632751BF49B9C00340587 /* Assets.xcassets */, 143 | 043632771BF49B9C00340587 /* LaunchScreen.storyboard */, 144 | 0436327A1BF49B9C00340587 /* Info.plist */, 145 | 043632691BF49B9C00340587 /* Supporting Files */, 146 | ); 147 | path = "JCPullToSelect-master"; 148 | sourceTree = ""; 149 | }; 150 | 043632691BF49B9C00340587 /* Supporting Files */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 0436326A1BF49B9C00340587 /* main.m */, 154 | ); 155 | name = "Supporting Files"; 156 | sourceTree = ""; 157 | }; 158 | 043632821BF49B9C00340587 /* JCPullToSelect-masterTests */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 043632831BF49B9C00340587 /* JCPullToSelect_masterTests.m */, 162 | 043632851BF49B9C00340587 /* Info.plist */, 163 | ); 164 | path = "JCPullToSelect-masterTests"; 165 | sourceTree = ""; 166 | }; 167 | 0436328D1BF49B9C00340587 /* JCPullToSelect-masterUITests */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 0436328E1BF49B9C00340587 /* JCPullToSelect_masterUITests.m */, 171 | 043632901BF49B9C00340587 /* Info.plist */, 172 | ); 173 | path = "JCPullToSelect-masterUITests"; 174 | sourceTree = ""; 175 | }; 176 | 0436329C1BF49BB000340587 /* JCPullToSelect */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 04D5142C1BF5B47A0036ACBD /* JCPullToSelect.bundle */, 180 | 043632A61BF49E8900340587 /* JCPullToSelect.h */, 181 | 0436329D1BF49BCD00340587 /* JCHeader.h */, 182 | 0436329E1BF49BCD00340587 /* JCHeader.m */, 183 | 043632A01BF49BE500340587 /* JCBallLayer.h */, 184 | 043632A11BF49BE500340587 /* JCBallLayer.m */, 185 | 04D8EF581BF9C46700957047 /* JCFooter.h */, 186 | 04D8EF591BF9C46700957047 /* JCFooter.m */, 187 | 043632A31BF49DBE00340587 /* UIScrollView+JCPullToSelect.h */, 188 | 043632A41BF49DBE00340587 /* UIScrollView+JCPullToSelect.m */, 189 | ); 190 | path = JCPullToSelect; 191 | sourceTree = ""; 192 | }; 193 | 0497163F1BF5F18F00C31B48 /* html */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 04D8EF561BF9B82A00957047 /* 1.html */, 197 | 049716441BF5F2B800C31B48 /* 2.html */, 198 | ); 199 | path = html; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXGroup section */ 203 | 204 | /* Begin PBXNativeTarget section */ 205 | 043632651BF49B9C00340587 /* JCPullToSelect-master */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 043632931BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-master" */; 208 | buildPhases = ( 209 | 043632621BF49B9C00340587 /* Sources */, 210 | 043632631BF49B9C00340587 /* Frameworks */, 211 | 043632641BF49B9C00340587 /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = "JCPullToSelect-master"; 218 | productName = "JCPullToSelect-master"; 219 | productReference = 043632661BF49B9C00340587 /* JCPullToSelect-master.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | 0436327E1BF49B9C00340587 /* JCPullToSelect-masterTests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 043632961BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-masterTests" */; 225 | buildPhases = ( 226 | 0436327B1BF49B9C00340587 /* Sources */, 227 | 0436327C1BF49B9C00340587 /* Frameworks */, 228 | 0436327D1BF49B9C00340587 /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 043632811BF49B9C00340587 /* PBXTargetDependency */, 234 | ); 235 | name = "JCPullToSelect-masterTests"; 236 | productName = "JCPullToSelect-masterTests"; 237 | productReference = 0436327F1BF49B9C00340587 /* JCPullToSelect-masterTests.xctest */; 238 | productType = "com.apple.product-type.bundle.unit-test"; 239 | }; 240 | 043632891BF49B9C00340587 /* JCPullToSelect-masterUITests */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = 043632991BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-masterUITests" */; 243 | buildPhases = ( 244 | 043632861BF49B9C00340587 /* Sources */, 245 | 043632871BF49B9C00340587 /* Frameworks */, 246 | 043632881BF49B9C00340587 /* Resources */, 247 | ); 248 | buildRules = ( 249 | ); 250 | dependencies = ( 251 | 0436328C1BF49B9C00340587 /* PBXTargetDependency */, 252 | ); 253 | name = "JCPullToSelect-masterUITests"; 254 | productName = "JCPullToSelect-masterUITests"; 255 | productReference = 0436328A1BF49B9C00340587 /* JCPullToSelect-masterUITests.xctest */; 256 | productType = "com.apple.product-type.bundle.ui-testing"; 257 | }; 258 | /* End PBXNativeTarget section */ 259 | 260 | /* Begin PBXProject section */ 261 | 0436325E1BF49B9C00340587 /* Project object */ = { 262 | isa = PBXProject; 263 | attributes = { 264 | LastUpgradeCheck = 0700; 265 | ORGANIZATIONNAME = HJaycee; 266 | TargetAttributes = { 267 | 043632651BF49B9C00340587 = { 268 | CreatedOnToolsVersion = 7.0.1; 269 | DevelopmentTeam = MZNXS3D2H4; 270 | }; 271 | 0436327E1BF49B9C00340587 = { 272 | CreatedOnToolsVersion = 7.0.1; 273 | TestTargetID = 043632651BF49B9C00340587; 274 | }; 275 | 043632891BF49B9C00340587 = { 276 | CreatedOnToolsVersion = 7.0.1; 277 | TestTargetID = 043632651BF49B9C00340587; 278 | }; 279 | }; 280 | }; 281 | buildConfigurationList = 043632611BF49B9C00340587 /* Build configuration list for PBXProject "JCPullToSelect-master" */; 282 | compatibilityVersion = "Xcode 3.2"; 283 | developmentRegion = English; 284 | hasScannedForEncodings = 0; 285 | knownRegions = ( 286 | en, 287 | Base, 288 | ); 289 | mainGroup = 0436325D1BF49B9C00340587; 290 | productRefGroup = 043632671BF49B9C00340587 /* Products */; 291 | projectDirPath = ""; 292 | projectRoot = ""; 293 | targets = ( 294 | 043632651BF49B9C00340587 /* JCPullToSelect-master */, 295 | 0436327E1BF49B9C00340587 /* JCPullToSelect-masterTests */, 296 | 043632891BF49B9C00340587 /* JCPullToSelect-masterUITests */, 297 | ); 298 | }; 299 | /* End PBXProject section */ 300 | 301 | /* Begin PBXResourcesBuildPhase section */ 302 | 043632641BF49B9C00340587 /* Resources */ = { 303 | isa = PBXResourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 04D8EF571BF9B82A00957047 /* 1.html in Resources */, 307 | 049716451BF5F2B800C31B48 /* 2.html in Resources */, 308 | 043632791BF49B9C00340587 /* LaunchScreen.storyboard in Resources */, 309 | 043632761BF49B9C00340587 /* Assets.xcassets in Resources */, 310 | 04D5142D1BF5B47A0036ACBD /* JCPullToSelect.bundle in Resources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | 0436327D1BF49B9C00340587 /* Resources */ = { 315 | isa = PBXResourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | 043632881BF49B9C00340587 /* Resources */ = { 322 | isa = PBXResourcesBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | /* End PBXResourcesBuildPhase section */ 329 | 330 | /* Begin PBXSourcesBuildPhase section */ 331 | 043632621BF49B9C00340587 /* Sources */ = { 332 | isa = PBXSourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | 043632A51BF49DBE00340587 /* UIScrollView+JCPullToSelect.m in Sources */, 336 | 049716391BF5E97F00C31B48 /* JCTableViewController.m in Sources */, 337 | 0497163C1BF5EB8E00C31B48 /* JCWebViewController.m in Sources */, 338 | 04D8EF551BF9B10900957047 /* JCCollectionViewController.m in Sources */, 339 | 043632711BF49B9C00340587 /* ViewController.m in Sources */, 340 | 0436326E1BF49B9C00340587 /* AppDelegate.m in Sources */, 341 | 0436326B1BF49B9C00340587 /* main.m in Sources */, 342 | 043632A21BF49BE500340587 /* JCBallLayer.m in Sources */, 343 | 0436329F1BF49BCD00340587 /* JCHeader.m in Sources */, 344 | 04D8EF5A1BF9C46700957047 /* JCFooter.m in Sources */, 345 | ); 346 | runOnlyForDeploymentPostprocessing = 0; 347 | }; 348 | 0436327B1BF49B9C00340587 /* Sources */ = { 349 | isa = PBXSourcesBuildPhase; 350 | buildActionMask = 2147483647; 351 | files = ( 352 | 043632841BF49B9C00340587 /* JCPullToSelect_masterTests.m in Sources */, 353 | ); 354 | runOnlyForDeploymentPostprocessing = 0; 355 | }; 356 | 043632861BF49B9C00340587 /* Sources */ = { 357 | isa = PBXSourcesBuildPhase; 358 | buildActionMask = 2147483647; 359 | files = ( 360 | 0436328F1BF49B9C00340587 /* JCPullToSelect_masterUITests.m in Sources */, 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | }; 364 | /* End PBXSourcesBuildPhase section */ 365 | 366 | /* Begin PBXTargetDependency section */ 367 | 043632811BF49B9C00340587 /* PBXTargetDependency */ = { 368 | isa = PBXTargetDependency; 369 | target = 043632651BF49B9C00340587 /* JCPullToSelect-master */; 370 | targetProxy = 043632801BF49B9C00340587 /* PBXContainerItemProxy */; 371 | }; 372 | 0436328C1BF49B9C00340587 /* PBXTargetDependency */ = { 373 | isa = PBXTargetDependency; 374 | target = 043632651BF49B9C00340587 /* JCPullToSelect-master */; 375 | targetProxy = 0436328B1BF49B9C00340587 /* PBXContainerItemProxy */; 376 | }; 377 | /* End PBXTargetDependency section */ 378 | 379 | /* Begin PBXVariantGroup section */ 380 | 043632771BF49B9C00340587 /* LaunchScreen.storyboard */ = { 381 | isa = PBXVariantGroup; 382 | children = ( 383 | 043632781BF49B9C00340587 /* Base */, 384 | ); 385 | name = LaunchScreen.storyboard; 386 | sourceTree = ""; 387 | }; 388 | /* End PBXVariantGroup section */ 389 | 390 | /* Begin XCBuildConfiguration section */ 391 | 043632911BF49B9C00340587 /* Debug */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 396 | CLANG_CXX_LIBRARY = "libc++"; 397 | CLANG_ENABLE_MODULES = YES; 398 | CLANG_ENABLE_OBJC_ARC = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 406 | CLANG_WARN_UNREACHABLE_CODE = YES; 407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 409 | COPY_PHASE_STRIP = NO; 410 | DEBUG_INFORMATION_FORMAT = dwarf; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | ENABLE_TESTABILITY = YES; 413 | GCC_C_LANGUAGE_STANDARD = gnu99; 414 | GCC_DYNAMIC_NO_PIC = NO; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_OPTIMIZATION_LEVEL = 0; 417 | GCC_PREPROCESSOR_DEFINITIONS = ( 418 | "DEBUG=1", 419 | "$(inherited)", 420 | ); 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 428 | MTL_ENABLE_DEBUG_INFO = YES; 429 | ONLY_ACTIVE_ARCH = YES; 430 | SDKROOT = iphoneos; 431 | }; 432 | name = Debug; 433 | }; 434 | 043632921BF49B9C00340587 /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ALWAYS_SEARCH_USER_PATHS = NO; 438 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 439 | CLANG_CXX_LIBRARY = "libc++"; 440 | CLANG_ENABLE_MODULES = YES; 441 | CLANG_ENABLE_OBJC_ARC = YES; 442 | CLANG_WARN_BOOL_CONVERSION = YES; 443 | CLANG_WARN_CONSTANT_CONVERSION = YES; 444 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INT_CONVERSION = YES; 448 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 449 | CLANG_WARN_UNREACHABLE_CODE = YES; 450 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 451 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 452 | COPY_PHASE_STRIP = NO; 453 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 454 | ENABLE_NS_ASSERTIONS = NO; 455 | ENABLE_STRICT_OBJC_MSGSEND = YES; 456 | GCC_C_LANGUAGE_STANDARD = gnu99; 457 | GCC_NO_COMMON_BLOCKS = YES; 458 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 459 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 460 | GCC_WARN_UNDECLARED_SELECTOR = YES; 461 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 462 | GCC_WARN_UNUSED_FUNCTION = YES; 463 | GCC_WARN_UNUSED_VARIABLE = YES; 464 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 465 | MTL_ENABLE_DEBUG_INFO = NO; 466 | SDKROOT = iphoneos; 467 | VALIDATE_PRODUCT = YES; 468 | }; 469 | name = Release; 470 | }; 471 | 043632941BF49B9C00340587 /* Debug */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 475 | CODE_SIGN_IDENTITY = "iPhone Developer"; 476 | INFOPLIST_FILE = "JCPullToSelect-master/Info.plist"; 477 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 479 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-master"; 480 | PRODUCT_NAME = "$(TARGET_NAME)"; 481 | }; 482 | name = Debug; 483 | }; 484 | 043632951BF49B9C00340587 /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CODE_SIGN_IDENTITY = "iPhone Developer"; 489 | INFOPLIST_FILE = "JCPullToSelect-master/Info.plist"; 490 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 491 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 492 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-master"; 493 | PRODUCT_NAME = "$(TARGET_NAME)"; 494 | }; 495 | name = Release; 496 | }; 497 | 043632971BF49B9C00340587 /* Debug */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | BUNDLE_LOADER = "$(TEST_HOST)"; 501 | INFOPLIST_FILE = "JCPullToSelect-masterTests/Info.plist"; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 503 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-masterTests"; 504 | PRODUCT_NAME = "$(TARGET_NAME)"; 505 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JCPullToSelect-master.app/JCPullToSelect-master"; 506 | }; 507 | name = Debug; 508 | }; 509 | 043632981BF49B9C00340587 /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | buildSettings = { 512 | BUNDLE_LOADER = "$(TEST_HOST)"; 513 | INFOPLIST_FILE = "JCPullToSelect-masterTests/Info.plist"; 514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 515 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-masterTests"; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JCPullToSelect-master.app/JCPullToSelect-master"; 518 | }; 519 | name = Release; 520 | }; 521 | 0436329A1BF49B9C00340587 /* Debug */ = { 522 | isa = XCBuildConfiguration; 523 | buildSettings = { 524 | INFOPLIST_FILE = "JCPullToSelect-masterUITests/Info.plist"; 525 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 526 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-masterUITests"; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TEST_TARGET_NAME = "JCPullToSelect-master"; 529 | USES_XCTRUNNER = YES; 530 | }; 531 | name = Debug; 532 | }; 533 | 0436329B1BF49B9C00340587 /* Release */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | INFOPLIST_FILE = "JCPullToSelect-masterUITests/Info.plist"; 537 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 538 | PRODUCT_BUNDLE_IDENTIFIER = "Hjaycee.JCPullToSelect-masterUITests"; 539 | PRODUCT_NAME = "$(TARGET_NAME)"; 540 | TEST_TARGET_NAME = "JCPullToSelect-master"; 541 | USES_XCTRUNNER = YES; 542 | }; 543 | name = Release; 544 | }; 545 | /* End XCBuildConfiguration section */ 546 | 547 | /* Begin XCConfigurationList section */ 548 | 043632611BF49B9C00340587 /* Build configuration list for PBXProject "JCPullToSelect-master" */ = { 549 | isa = XCConfigurationList; 550 | buildConfigurations = ( 551 | 043632911BF49B9C00340587 /* Debug */, 552 | 043632921BF49B9C00340587 /* Release */, 553 | ); 554 | defaultConfigurationIsVisible = 0; 555 | defaultConfigurationName = Release; 556 | }; 557 | 043632931BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-master" */ = { 558 | isa = XCConfigurationList; 559 | buildConfigurations = ( 560 | 043632941BF49B9C00340587 /* Debug */, 561 | 043632951BF49B9C00340587 /* Release */, 562 | ); 563 | defaultConfigurationIsVisible = 0; 564 | defaultConfigurationName = Release; 565 | }; 566 | 043632961BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-masterTests" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 043632971BF49B9C00340587 /* Debug */, 570 | 043632981BF49B9C00340587 /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 043632991BF49B9C00340587 /* Build configuration list for PBXNativeTarget "JCPullToSelect-masterUITests" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 0436329A1BF49B9C00340587 /* Debug */, 579 | 0436329B1BF49B9C00340587 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | /* End XCConfigurationList section */ 585 | }; 586 | rootObject = 0436325E1BF49B9C00340587 /* Project object */; 587 | } 588 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/xcuserdata/mac.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/JCPullToSelect-master.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JCPullToSelect-master.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 043632651BF49B9C00340587 16 | 17 | primary 18 | 19 | 20 | 0436327E1BF49B9C00340587 21 | 22 | primary 23 | 24 | 25 | 043632891BF49B9C00340587 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. 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 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ViewController new]]; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application { 28 | // 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. 29 | // 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. 30 | } 31 | 32 | - (void)applicationDidEnterBackground:(UIApplication *)application { 33 | // 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. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application { 38 | // 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. 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 | - (void)applicationWillTerminate:(UIApplication *)application { 46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_down_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_normal.imageset/jc_down_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_normal.imageset/jc_down_normal@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_down_selected@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_selected.imageset/jc_down_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_down_selected.imageset/jc_down_selected@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_refresh_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_normal.imageset/jc_refresh_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_normal.imageset/jc_refresh_normal@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_refresh_selected@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_selected.imageset/jc_refresh_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_refresh_selected.imageset/jc_refresh_selected@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_up_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_normal.imageset/jc_up_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_normal.imageset/jc_up_normal@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "jc_up_selected@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_selected.imageset/jc_up_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/Assets.xcassets/jc_up_selected.imageset/jc_up_selected@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCCollectionViewController.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/16. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JCCollectionViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCCollectionViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // JCCollectionViewController.m 4 | // JCPullToSelect-master 5 | // 6 | // Created by mac on 15/11/16. 7 | // Copyright © 2015年 HJaycee. All rights reserved. 8 | // 9 | 10 | #import "JCCollectionViewController.h" 11 | #import "JCPullToSelect.h" 12 | 13 | @interface JCCollectionViewController() 14 | 15 | @property (strong, nonatomic) NSMutableArray *colors; 16 | 17 | @end 18 | 19 | @implementation JCCollectionViewController 20 | 21 | - (NSMutableArray *)colors 22 | { 23 | if (!_colors) { 24 | self.colors = [NSMutableArray array]; 25 | } 26 | return _colors; 27 | } 28 | 29 | - (id)init 30 | { 31 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 32 | CGFloat width = (JCScreenWidth - 30) / 2; 33 | layout.itemSize = CGSizeMake(width, width); 34 | layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); 35 | return [self initWithCollectionViewLayout:layout]; 36 | } 37 | 38 | static NSString *const JCCollectionViewCellIdentifier = @"color"; 39 | - (void)viewDidLoad 40 | { 41 | [super viewDidLoad]; 42 | 43 | self.title = @"JCCollectionViewController"; 44 | 45 | self.collectionView.backgroundColor = [UIColor whiteColor]; 46 | [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:JCCollectionViewCellIdentifier]; 47 | 48 | [self updateColor]; 49 | 50 | // 下拉刷新 51 | self.collectionView.header = [JCHeader headerWithDefaultIndex:0 ballColor:[UIColor orangeColor] normalViews:@[JCNormalRefreshView] selectedViews:@[JCSelectedRefreshView] callback:^(JCHeader *header, NSInteger index) { 52 | // 模拟服务器请求延时(拿去用的时候请删除这段代码) 53 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 54 | // 改变格子颜色 55 | [self updateColor]; 56 | // 停止刷新 57 | [header endRefreshing]; 58 | }); 59 | }]; 60 | } 61 | 62 | - (void)updateColor{ 63 | [self.colors removeAllObjects]; 64 | UIColor *color = [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1]; 65 | for (int i = 0; i<10; i++) { 66 | [self.colors addObject:color]; 67 | } 68 | [self.collectionView reloadData]; 69 | } 70 | 71 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 72 | { 73 | return self.colors.count; 74 | } 75 | 76 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 77 | { 78 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:JCCollectionViewCellIdentifier forIndexPath:indexPath]; 79 | cell.backgroundColor = self.colors[indexPath.row]; 80 | return cell; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCBallLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCBallLayer.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JCBallLayer : CALayer 13 | 14 | @property (nonatomic, strong) UIColor *ballColor; 15 | 16 | @property (nonatomic) CGFloat ratio; 17 | @property (nonatomic) CGFloat originX; 18 | @property (nonatomic) CGFloat originY; 19 | @property (nonatomic) CGFloat radiusWLeft; 20 | @property (nonatomic) CGFloat radiusWRight; 21 | @property (nonatomic) CGFloat radiusH; 22 | 23 | - (void)animateToNewOriginX:(CGFloat)newOriginX; 24 | 25 | - (void)refreshAnimating; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCBallLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCBallLayer.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCBallLayer.h" 10 | #import "JCPullToSelect.h" 11 | 12 | @implementation JCBallLayer 13 | 14 | - (instancetype)init{ 15 | if (self = [super init]) { 16 | self.ratio = 0.551915024494; 17 | } 18 | return self; 19 | } 20 | 21 | -(id)initWithLayer:(JCBallLayer *)layer{ 22 | self = [super initWithLayer:layer]; 23 | if (self) { 24 | self.ballColor = layer.ballColor; 25 | self.ratio = layer.ratio; 26 | self.originX = layer.originX; 27 | self.originY = layer.originY; 28 | self.radiusWLeft = layer.radiusWLeft; 29 | self.radiusWRight = layer.radiusWRight; 30 | self.radiusH = layer.radiusH; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)drawInContext:(CGContextRef)ctx{ 36 | CGFloat leftX = self.originX - self.radiusWLeft; 37 | CGFloat leftY = self.originY; 38 | 39 | CGFloat topX = self.originX; 40 | CGFloat topY = self.originY - self.radiusH; 41 | CGFloat controlX1 = leftX; 42 | CGFloat controlY1 = self.originY - self.radiusH * self.ratio; 43 | CGFloat controlX2 = self.originX - self.radiusWLeft * self.ratio; 44 | CGFloat controlY2 = self.originY - self.radiusH; 45 | 46 | CGFloat rightX = self.originX + self.radiusWRight; 47 | CGFloat rightY = self.originY; 48 | CGFloat controlX3 = self.originX + self.radiusWRight * self.ratio; 49 | CGFloat controlY3 = self.originY - self.radiusH; 50 | CGFloat controlX4 = rightX; 51 | CGFloat controlY4 = self.originY - self.radiusH * self.ratio; 52 | 53 | CGFloat bottomX = self.originX; 54 | CGFloat bottomY = self.originY + self.radiusH; 55 | CGFloat controlX5 = rightX; 56 | CGFloat controlY5 = self.originY + self.radiusH * self.ratio; 57 | CGFloat controlX6 = self.originX + self.radiusWRight * self.ratio; 58 | CGFloat controlY6 = self.originY + self.radiusH; 59 | 60 | CGFloat controlX7 = self.originX - self.radiusWLeft * self.ratio; 61 | CGFloat controlY7 = self.originY + self.radiusH; 62 | CGFloat controlX8 = leftX; 63 | CGFloat controlY8 = self.originY + self.radiusH * self.ratio; 64 | 65 | UIBezierPath *path = [UIBezierPath bezierPath]; 66 | 67 | [path moveToPoint:CGPointMake(leftX, leftY)]; 68 | [path addCurveToPoint:CGPointMake(topX, topY) controlPoint1:CGPointMake(controlX1, controlY1) controlPoint2:CGPointMake(controlX2, controlY2)]; 69 | [path addCurveToPoint:CGPointMake(rightX, rightY) controlPoint1:CGPointMake(controlX3, controlY3) controlPoint2:CGPointMake(controlX4, controlY4)]; 70 | [path addCurveToPoint:CGPointMake(bottomX, bottomY) controlPoint1:CGPointMake(controlX5, controlY5) controlPoint2:CGPointMake(controlX6, controlY6)]; 71 | [path addCurveToPoint:CGPointMake(leftX, leftY) controlPoint1:CGPointMake(controlX7, controlY7) controlPoint2:CGPointMake(controlX8, controlY8)]; 72 | 73 | [path closePath]; 74 | 75 | CGContextAddPath(ctx, path.CGPath); 76 | CGContextSetFillColorWithColor(ctx, self.ballColor.CGColor); 77 | CGContextFillPath(ctx); 78 | } 79 | 80 | - (void)animateToNewOriginX:(CGFloat)newOriginX{ 81 | NSArray *keyPaths = @[@"radiusWLeft", @"radiusWRight", @"originX"]; 82 | NSArray *valuesArray = @[@[@(self.radiusWLeft),@25], 83 | @[@(self.radiusWRight),@25], 84 | @[@(self.originX),@(newOriginX)]]; 85 | 86 | for (int i = 0; i 10 | 11 | @class JCFooter; 12 | 13 | typedef void(^JCFooterCallback)(JCFooter *footer); 14 | 15 | @interface JCFooter : UIView 16 | 17 | // 创建一个上拉刷新控件 18 | + (instancetype)footerWithCallback:(JCFooterCallback)callback; 19 | 20 | // 停止下拉刷新 21 | - (void)endRefreshing; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCFooter.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/16. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCFooter.h" 10 | #import "JCPullToSelect.h" 11 | 12 | #define FooterHeight 40 13 | 14 | @interface JCFooter () 15 | 16 | @property (nonatomic, copy) JCFooterCallback callBack; 17 | @property (nonatomic, weak) UIScrollView *superScrollView; 18 | @property (nonatomic, getter=isCanRefresh) BOOL canRefresh; 19 | @property (nonatomic, getter=isRefreshing) BOOL refreshing; 20 | @property (nonatomic, strong) UIActivityIndicatorView *aiView; 21 | @property (nonatomic, strong) UILabel *tipLabel; 22 | 23 | @end 24 | 25 | @implementation JCFooter 26 | 27 | + (instancetype)footerWithCallback:(JCFooterCallback)callback{ 28 | JCFooter *footer = [[JCFooter alloc] initWithFrame:CGRectMake(0, 0, JCScreenWidth, FooterHeight)]; 29 | footer.backgroundColor = [UIColor clearColor]; 30 | footer.callBack = callback; 31 | [footer setup]; 32 | return footer; 33 | } 34 | 35 | - (void)setup{ 36 | self.tipLabel = [[UILabel alloc] initWithFrame:self.bounds]; 37 | self.tipLabel.text = JCFooterTipReadyText; 38 | self.tipLabel.font = JCFooterTipTextFont; 39 | self.tipLabel.textColor = JCFooterTipTextColor; 40 | self.tipLabel.backgroundColor = [UIColor clearColor]; 41 | self.tipLabel.textAlignment = NSTextAlignmentCenter; 42 | [self addSubview:self.tipLabel]; 43 | 44 | self.aiView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 45 | self.aiView.center = CGPointMake(JCScreenWidth * 0.35, self.frame.size.height * 0.5); 46 | [self addSubview:self.aiView]; 47 | } 48 | 49 | - (void)willMoveToSuperview:(UIView *)newSuperview{ 50 | if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; 51 | 52 | [self removeObservers]; 53 | 54 | self.superScrollView = (UIScrollView *)newSuperview; 55 | self.superScrollView.alwaysBounceVertical = YES; 56 | 57 | [self moveFooter]; 58 | 59 | [self addObservers]; 60 | } 61 | 62 | - (void)dealloc{ 63 | [self removeObservers]; 64 | } 65 | 66 | - (void)addObservers{ 67 | NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; 68 | [self.superScrollView addObserver:self forKeyPath:@"contentOffset" options:options context:nil]; 69 | } 70 | 71 | - (void)removeObservers{ 72 | [self.superview removeObserver:self forKeyPath:@"contentOffset"]; 73 | } 74 | 75 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ 76 | if ([keyPath isEqualToString:@"contentOffset"]) { 77 | [self scrollViewContentOffsetDidChange:change]; 78 | } 79 | } 80 | 81 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{ 82 | [self moveFooter]; 83 | 84 | if (self.superScrollView.isDragging) { 85 | self.canRefresh = NO; 86 | self.refreshing = NO; 87 | self.tipLabel.text = JCFooterTipReadyText; 88 | [self.aiView stopAnimating]; 89 | } else { 90 | self.canRefresh = YES; 91 | } 92 | 93 | CGFloat contentInsetT = self.superScrollView.contentInset.top; 94 | CGFloat contentOffsetY = self.superScrollView.contentOffset.y; 95 | CGFloat rectH = self.superScrollView.frame.size.height; 96 | CGFloat contentSizeH = self.superScrollView.contentSize.height; 97 | CGFloat canScrollH = contentSizeH - (rectH - contentInsetT); 98 | CGFloat needContentOffsetY = -contentInsetT + canScrollH + FooterHeight; 99 | 100 | if (!self.canRefresh || self.refreshing || self.hidden) return; 101 | 102 | if (canScrollH > 0) { 103 | // 在屏幕外面 104 | if (contentOffsetY >= needContentOffsetY) { 105 | [self.superScrollView setContentOffset:CGPointMake(0, needContentOffsetY) animated:YES]; 106 | [self refreshing]; 107 | } 108 | } else { 109 | // 全部在屏幕里面 110 | if (canScrollH + FooterHeight > 0) { 111 | // 上拉控件在屏幕外面 112 | if (contentOffsetY >= needContentOffsetY) { 113 | [self.superScrollView setContentOffset:CGPointMake(0, needContentOffsetY) animated:YES]; 114 | [self refreshing]; 115 | } 116 | } else { 117 | // 上拉控件在屏幕里面,上拉操作完后,不改变contentOffset 118 | if (contentOffsetY >= -contentInsetT + FooterHeight) { 119 | [self refreshing]; 120 | } 121 | } 122 | } 123 | } 124 | 125 | - (void)moveFooter{ 126 | CGRect f = self.frame; 127 | f.origin.y = self.superScrollView .contentSize.height; 128 | self.frame = f; 129 | } 130 | 131 | - (void)refreshing{ 132 | self.tipLabel.text = JCFooterTipRefreshingText; 133 | self.superScrollView.userInteractionEnabled = NO; 134 | self.refreshing = YES; 135 | [self.aiView startAnimating]; 136 | self.callBack(self); 137 | } 138 | 139 | - (void)endRefreshing{ 140 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 141 | self.superScrollView.userInteractionEnabled = YES; 142 | self.tipLabel.text = JCFooterTipReadyText; 143 | [self.aiView stopAnimating]; 144 | }); 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCHeader.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class JCHeader; 12 | 13 | typedef void(^JCHeaderCallback)(JCHeader *header, NSInteger index); 14 | 15 | @interface JCHeader : UIView 16 | 17 | /** 18 | * 功能: 19 | * 创建一个下拉刷新控件 20 | * 参数: 21 | * defaultIndex:默认选中的index 22 | * ballColor:弹性球的颜色,传nil就是默认色 23 | * normalViews:非选中状态的view数组 24 | * selectedViews:选中状态的view数组 25 | * selectBlock:回调,会传回header和index,header用来调用endRefreshing方法,index用来做相应的处理 26 | */ 27 | + (instancetype)headerWithDefaultIndex:(NSInteger)defaultIndex ballColor:(UIColor *)ballColor normalViews:(NSArray *)normalViews selectedViews:(NSArray *)selectedViews callback:(JCHeaderCallback)callback; 28 | 29 | // 停止下拉刷新 30 | - (void)endRefreshing; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCHeader.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCHeader.h" 10 | #import "JCPullToSelect.h" 11 | 12 | // 勿改 13 | #define BallRadius 25 14 | #define BallWidth BallRadius * 2 15 | #define ViewHeight 66 16 | #define LeaveMoveRate 0.45 17 | 18 | @interface JCHeader () 19 | 20 | @property (nonatomic, weak) JCBallLayer *ballLayer; 21 | @property (nonatomic, strong) NSArray *normalViews; 22 | @property (nonatomic, strong) NSArray *selectedViews; 23 | @property (nonatomic, copy) JCHeaderCallback selectBlock; 24 | @property (nonatomic, strong) UILabel *tipLabel; 25 | @property (nonatomic, weak) UIScrollView *superScrollView; 26 | @property (nonatomic, getter=isCanRefresh) BOOL canRefresh; 27 | @property (nonatomic, getter=isRefreshing) BOOL refreshing; 28 | @property (nonatomic, strong) UIImageView *rotationView; 29 | 30 | @end 31 | 32 | static NSInteger count; 33 | static NSInteger defaultIndex; 34 | 35 | @implementation JCHeader 36 | { 37 | CGFloat margin; 38 | NSInteger index; 39 | CGFloat defaultOriginX; 40 | CGFloat defaultOriginY; 41 | CGFloat defaultRadiusH; 42 | CGFloat defaultRadiusWLeft; 43 | CGFloat defaultRadiusWRight; 44 | CGFloat originContentInsetTop; 45 | } 46 | 47 | - (instancetype)initWithFrame:(CGRect)frame ballLayerColor:(UIColor *)ballLayerColor{ 48 | if (self = [super initWithFrame:frame]) { 49 | JCBallLayer *ballLayer = [[JCBallLayer alloc] init]; 50 | ballLayer.frame = self.bounds; 51 | ballLayer.contentsScale = [UIScreen mainScreen].scale; 52 | ballLayer.ballColor = ballLayerColor; 53 | [self.layer addSublayer:ballLayer]; 54 | self.ballLayer = ballLayer; 55 | 56 | self.rotationView = [[UIImageView alloc] initWithImage:[self changeImage:JCRefreshingImage toColor:ballLayerColor]]; 57 | self.rotationView.frame = CGRectMake(0, 0, BallWidth, BallWidth); 58 | [self addSubview:self.rotationView]; 59 | self.rotationView.alpha = 0; 60 | 61 | [self initialization]; 62 | } 63 | return self; 64 | } 65 | 66 | - (UIImage *)changeImage:(UIImage *)image toColor:(UIColor *)color{ 67 | UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale); 68 | CGContextRef context = UIGraphicsGetCurrentContext(); 69 | CGContextTranslateCTM(context, 0, image.size.height); 70 | CGContextScaleCTM(context, 1.0, -1.0); 71 | CGContextSetBlendMode(context, kCGBlendModeNormal); 72 | CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); 73 | CGContextClipToMask(context, rect, image.CGImage); 74 | [color setFill]; 75 | CGContextFillRect(context, rect); 76 | UIImage*newImage = UIGraphicsGetImageFromCurrentImageContext(); 77 | UIGraphicsEndImageContext(); 78 | return newImage; 79 | } 80 | 81 | - (void)initialization{ 82 | margin = (self.frame.size.width - BallWidth * count) / (count + 1); 83 | index = defaultIndex; 84 | 85 | defaultOriginX = BallRadius + BallWidth * index + margin * (index + 1); 86 | defaultOriginY = self.frame.size.height / 2; 87 | defaultRadiusH = BallRadius; 88 | defaultRadiusWLeft = BallRadius; 89 | defaultRadiusWRight = BallRadius; 90 | 91 | [self resetBall]; 92 | 93 | [self.ballLayer setNeedsDisplay]; 94 | } 95 | 96 | - (void)change:(CGFloat)change{ 97 | [self ifShowTipLabel]; 98 | 99 | [self moveLeftWithChange:change]; 100 | [self moveRightWithChange:change]; 101 | 102 | [self.ballLayer setNeedsDisplay]; 103 | } 104 | 105 | - (void)moveLeftWithChange:(CGFloat)change{ 106 | if (index == 0) return; 107 | CGFloat move = margin; 108 | change += defaultIndex * (margin + defaultRadiusH * 2); 109 | if (change < defaultRadiusH + margin + (defaultRadiusH * 2 + margin) * (index - 1)) { 110 | [self deformToLeftWithChange:change - margin - defaultRadiusH - (defaultRadiusH * 2 + margin) * (index - 1)]; 111 | } 112 | if (change < defaultRadiusH + margin - move + (defaultRadiusH * 2 + margin) * (index - 1)) { 113 | index --; 114 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 115 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 116 | [self resetBall]; 117 | [self hasDrag]; 118 | } 119 | } 120 | 121 | - (void)moveRightWithChange:(CGFloat)change{ 122 | if (index == count -1) return; 123 | CGFloat move = margin; 124 | change += defaultIndex * (margin + defaultRadiusH * 2); 125 | if (change > defaultRadiusH + (margin + defaultRadiusH * 2) * index) { 126 | [self deformToRightWithChange:change - defaultRadiusH - (margin + defaultRadiusH * 2) * index]; 127 | } 128 | if (change > defaultRadiusH + move + (margin + defaultRadiusH * 2) * index) { 129 | index ++; 130 | [self toggleFocusView]; 131 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 132 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 133 | [self resetBall]; 134 | [self hasDrag]; 135 | } 136 | } 137 | 138 | - (void)hasDrag{ 139 | [[NSUserDefaults standardUserDefaults] setValue:JCPullToSelectHasDragedBallValue forKey:JCPullToSelectHasDragedBall]; 140 | } 141 | 142 | - (void)resetBall{ 143 | self.ballLayer.originX = defaultOriginX; 144 | self.ballLayer.originY = defaultOriginY; 145 | self.ballLayer.radiusH = defaultRadiusH; 146 | self.ballLayer.radiusWLeft = defaultRadiusWLeft; 147 | self.ballLayer.radiusWRight = defaultRadiusWRight; 148 | [self toggleFocusView]; 149 | } 150 | 151 | - (void)toggleFocusView{ 152 | NSInteger viewCount = self.normalViews.count; 153 | for (int i = 0; i normalViews.count - 1 || di < 0) { 209 | JCLog(@"JCPullToSelect Error:defaultIndex越界"); 210 | return nil; 211 | } 212 | count = normalViews.count; 213 | defaultIndex = di; 214 | UIColor *ballColor = bc; 215 | if (!ballColor) { 216 | ballColor = JCDefaultBallColor; 217 | } 218 | JCHeader *header = [[JCHeader alloc] initWithFrame:CGRectMake(0, -ViewHeight, JCScreenWidth, ViewHeight) ballLayerColor:ballColor]; 219 | header.selectBlock = callback; 220 | [header addNormalViews:normalViews]; 221 | [header addSelectedViews:selectedViews]; 222 | return header; 223 | } 224 | 225 | - (void)willMoveToSuperview:(UIView *)newSuperview{ 226 | [super willMoveToSuperview:newSuperview]; 227 | 228 | if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; 229 | 230 | [self removeObservers]; 231 | 232 | self.superScrollView = (UIScrollView *)newSuperview; 233 | self.superScrollView.alwaysBounceVertical = YES; 234 | originContentInsetTop = self.superScrollView.contentInset.top; 235 | CGRect f = self.frame; 236 | f.origin.y -= originContentInsetTop; 237 | self.frame = f; 238 | 239 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; 240 | pan.delegate = self; 241 | [self.superScrollView addGestureRecognizer:pan]; 242 | 243 | [self addObservers]; 244 | [self addTipLabel]; 245 | } 246 | 247 | - (void)pan:(UIPanGestureRecognizer *)gestureRecognizer{ 248 | if (gestureRecognizer.state == UIGestureRecognizerStateBegan) { 249 | [self initialization]; 250 | } 251 | CGPoint point = [gestureRecognizer translationInView:self]; 252 | 253 | [self change:point.x]; 254 | } 255 | 256 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { 257 | if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) { 258 | return YES; 259 | } 260 | return NO; 261 | } 262 | 263 | - (void)dealloc{ 264 | [self removeObservers]; 265 | [self endRefreshing]; 266 | } 267 | 268 | - (void)addTipLabel{ 269 | self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -11, JCScreenWidth, 11)]; 270 | self.tipLabel.text = JCFirstUseTipText; 271 | self.tipLabel.font = [UIFont systemFontOfSize:11]; 272 | self.tipLabel.textAlignment = NSTextAlignmentCenter; 273 | self.tipLabel.backgroundColor = [UIColor clearColor]; 274 | self.tipLabel.textColor = JCFirstUseTipTextColor; 275 | [self addSubview:self.tipLabel]; 276 | } 277 | 278 | - (void)ifShowTipLabel{ 279 | NSString *value = [[NSUserDefaults standardUserDefaults] valueForKey:JCPullToSelectHasDragedBall]; 280 | self.tipLabel.hidden = [value isEqual:JCPullToSelectHasDragedBallValue] || count == 1; 281 | } 282 | 283 | - (void)addObservers{ 284 | NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; 285 | [self.superScrollView addObserver:self forKeyPath:@"contentOffset" options:options context:nil]; 286 | } 287 | 288 | - (void)removeObservers{ 289 | [self.superview removeObserver:self forKeyPath:@"contentOffset"]; 290 | } 291 | 292 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ 293 | if ([keyPath isEqualToString:@"contentOffset"]) { 294 | [self scrollViewContentOffsetDidChange:change]; 295 | } 296 | } 297 | 298 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{ 299 | CGFloat newContentOffsetY = self.superScrollView.contentOffset.y; 300 | 301 | self.alpha = fabs(newContentOffsetY + self.superScrollView.contentInset.top) / ViewHeight; 302 | 303 | if (self.superScrollView.isDragging) { 304 | self.canRefresh = NO; 305 | self.refreshing = NO; 306 | } else { 307 | self.canRefresh = YES; 308 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 309 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 310 | [self resetBall]; 311 | } 312 | 313 | if (newContentOffsetY < -self.superScrollView.contentInset.top - ViewHeight && self.isCanRefresh && !self.isRefreshing) { 314 | [self.superScrollView setContentOffset:CGPointMake(0, -self.superScrollView.contentInset.top - ViewHeight) animated:YES]; 315 | self.superScrollView.userInteractionEnabled = NO; 316 | self.refreshing = YES; 317 | [self refreshAnimating]; 318 | [self.superScrollView showFooter]; 319 | self.selectBlock(self, index); 320 | } 321 | } 322 | 323 | - (void)refreshAnimating{ 324 | self.rotationView.center = CGPointMake(defaultOriginX, defaultOriginY); 325 | self.rotationView.alpha = 1; 326 | self.rotationView.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0); 327 | [UIView animateWithDuration:0.25 animations:^{ 328 | self.rotationView.layer.transform = CATransform3DMakeScale(1, 1, 0); 329 | } completion:^(BOOL finished) { 330 | CABasicAnimation* rotationAnimation; 331 | rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 332 | rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ]; 333 | rotationAnimation.duration = 3; 334 | rotationAnimation.cumulative = YES; 335 | rotationAnimation.repeatCount = HUGE_VALF; 336 | [self.rotationView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; 337 | }]; 338 | 339 | [self.ballLayer refreshAnimating]; 340 | } 341 | 342 | - (void)endRefreshing{ 343 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 344 | [UIView animateWithDuration:0.2 animations:^{ 345 | self.rotationView.alpha = 0; 346 | } completion:^(BOOL finished) { 347 | [self.rotationView.layer removeAllAnimations]; 348 | [self.ballLayer removeAllAnimations]; 349 | self.superScrollView.userInteractionEnabled = YES; 350 | }]; 351 | [self.superScrollView setContentOffset:CGPointMake(0, -self.superScrollView.contentInset.top) animated:YES]; 352 | }); 353 | } 354 | 355 | @end 356 | 357 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_normal@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_selected@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refreshing@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.bundle/jc_refreshing@2x.png -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/JCPullToSelect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * GitHub:https://github.com/HJaycee 3 | * 邮箱:hjaycee@163.com 4 | * http://blog.csdn.net/hjaycee 5 | * 如发现框架有bug或者有任何建议或疑问都请发我邮箱,谢谢! 6 | */ 7 | 8 | #import "JCHeader.h" 9 | #import "JCBallLayer.h" 10 | #import "JCFooter.h" 11 | #import "UIScrollView+JCPullToSelect.h" 12 | 13 | #ifdef DEBUG 14 | #define JCLog(...) NSLog(__VA_ARGS__) 15 | #else 16 | #define JCLog(...) 17 | #endif 18 | 19 | #define JCPullToSelectHasDragedBall @"JCPullToSelectHasDragedBall" 20 | #define JCPullToSelectHasDragedBallValue @"1" 21 | #define JCScreenWidth [UIScreen mainScreen].bounds.size.width 22 | #define JCScreenHeight [UIScreen mainScreen].bounds.size.height 23 | #define JCColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] 24 | 25 | // 默认的刷新图片View,可以直接拿来用 26 | #define JCNormalRefreshView [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"JCPullToSelect.bundle/jc_refresh_normal"]] 27 | #define JCSelectedRefreshView [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"JCPullToSelect.bundle/jc_refresh_selected"]] 28 | // 刷新中的旋转图片 29 | #define JCRefreshingImage [UIImage imageNamed:@"JCPullToSelect.bundle/jc_refreshing"] 30 | // --------------------- 参数设置 --------------------- 31 | 32 | // 第一次拖拽弹性球前的提示语,拖动过以后都不会再显示(第一次也不需要显示请设置空内容) 33 | #define JCFirstUseTipText @"继续左右拖动可选择其他功能" 34 | #define JCFirstUseTipTextColor JCColor(57,57,57) 35 | // 默认弹性球颜色 36 | #define JCDefaultBallColor JCColor(51,133,255) 37 | // 上拉刷新文字 38 | #define JCFooterTipReadyText @"上拉加载" 39 | #define JCFooterTipRefreshingText @"正在加载" 40 | #define JCFooterTipTextColor JCColor(57,57,57) 41 | #define JCFooterTipTextFont [UIFont systemFontOfSize:16] 42 | 43 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/UIScrollView+JCPullToSelect.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+JCPullToSelect.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JCHeader.h" 11 | #import "JCFooter.h" 12 | 13 | @interface UIScrollView (JCPullToSelect) 14 | 15 | @property (nonatomic, strong) JCHeader *header; 16 | @property (nonatomic, strong) JCFooter *footer; 17 | 18 | - (void)showFooter; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCPullToSelect/UIScrollView+JCPullToSelect.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+JCPullToSelect.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "UIScrollView+JCPullToSelect.h" 10 | #import 11 | 12 | @implementation UIScrollView (JCPullToSelect) 13 | 14 | static const char JCHeaderKey = '\0'; 15 | - (void)setHeader:(JCHeader *)header{ 16 | if (header != self.header) { 17 | [self.header removeFromSuperview]; 18 | [self addSubview:header]; 19 | 20 | [self willChangeValueForKey:@"header"]; 21 | objc_setAssociatedObject(self, &JCHeaderKey, header, OBJC_ASSOCIATION_ASSIGN); 22 | [self didChangeValueForKey:@"header"]; 23 | } 24 | } 25 | 26 | - (JCHeader *)header 27 | { 28 | return objc_getAssociatedObject(self, &JCHeaderKey); 29 | } 30 | 31 | static const char JCFooterKey = '\0'; 32 | - (void)setFooter:(JCFooter *)footer{ 33 | if (footer != self.footer) { 34 | [self.footer removeFromSuperview]; 35 | [self addSubview:footer]; 36 | 37 | [self willChangeValueForKey:@"footer"]; 38 | objc_setAssociatedObject(self, &JCFooterKey, footer, OBJC_ASSOCIATION_ASSIGN); 39 | [self didChangeValueForKey:@"footer"]; 40 | } 41 | } 42 | 43 | - (JCFooter *)footer 44 | { 45 | return objc_getAssociatedObject(self, &JCFooterKey); 46 | } 47 | 48 | - (void)showFooter{ 49 | self.footer.hidden = NO; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCTableViewController.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/13. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JCTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCTableViewController.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/13. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCTableViewController.h" 10 | #import "JCPullToSelect.h" 11 | 12 | @interface JCTableViewController () 13 | { 14 | NSInteger _loadMore; 15 | } 16 | 17 | @property (nonatomic, strong) NSMutableArray *dataArray; 18 | 19 | @end 20 | 21 | @implementation JCTableViewController 22 | 23 | - (NSMutableArray *)dataArray{ 24 | if (!_dataArray) { 25 | _dataArray = [NSMutableArray array]; 26 | } 27 | return _dataArray; 28 | } 29 | 30 | - (void)viewDidLoad{ 31 | [super viewDidLoad]; 32 | self.title = @"JCTableViewController"; 33 | 34 | self.tableView.backgroundColor = JCColor(245, 245, 245); 35 | 36 | // 默认不对数据排序 37 | [self noSort]; 38 | 39 | UIImageView *upViewNormal = [self createImageView:@"jc_up_normal"]; 40 | UIImageView *downViewNormal = [self createImageView:@"jc_down_normal"]; 41 | UIImageView *upViewSelected = [self createImageView:@"jc_up_selected"]; 42 | UIImageView *downViewSelected = [self createImageView:@"jc_down_selected"]; 43 | 44 | // 普通状态的view数组,显示在弹性球上面 45 | NSArray *normalViews = @[upViewNormal, JCNormalRefreshView, downViewNormal]; 46 | // 选中状态的view数组,显示在弹性球上面 47 | NSArray *selectedViews = @[upViewSelected, JCSelectedRefreshView, downViewSelected]; 48 | 49 | // 下拉刷新 50 | self.tableView.header = [JCHeader headerWithDefaultIndex:1 ballColor:nil normalViews:normalViews selectedViews:selectedViews callback:^(JCHeader *header, NSInteger index) { 51 | // 模拟服务器请求延时(拿去用的时候请删除这段代码) 52 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 53 | switch (index) { 54 | case 0: 55 | [self sortAscending]; 56 | break; 57 | case 1: 58 | [self noSort]; 59 | break; 60 | case 2: 61 | [self sortDescending]; 62 | break; 63 | } 64 | // 停止刷新 65 | [header endRefreshing]; 66 | }); 67 | }]; 68 | 69 | // 用来标记上拉次数(仅供测试) 70 | _loadMore = 0; 71 | 72 | // 上拉刷新 73 | self.tableView.footer = [JCFooter footerWithCallback:^(JCFooter *footer) { 74 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 75 | [footer endRefreshing]; 76 | 77 | // 假设上拉刷新2次以后服务器不再返回数据了(拿去用的时候请删除这段代码) 78 | _loadMore ++; 79 | if (_loadMore > 1) { 80 | // 隐藏footer,用于关闭上拉刷新功能 81 | footer.hidden = YES; 82 | _loadMore = 0; 83 | } 84 | // 随机数据 85 | for (int i = 0; i<5; i++) { 86 | [self.dataArray addObject:[NSString stringWithFormat:@"%zi", arc4random_uniform(1000)]]; 87 | } 88 | // 刷新表格 89 | [self.tableView reloadData]; 90 | }); 91 | }]; 92 | } 93 | 94 | // 升序 95 | - (void)sortAscending{ 96 | NSArray *array = @[@"1",@"2", @"3", @"4", @"5"]; 97 | [self.dataArray removeAllObjects]; 98 | for (NSString *str in array) { 99 | [self.dataArray addObject:str]; 100 | } 101 | [self.tableView reloadData]; 102 | } 103 | 104 | // 降序 105 | - (void)sortDescending{ 106 | NSArray *array = @[@"5",@"4", @"3", @"2", @"1"]; 107 | [self.dataArray removeAllObjects]; 108 | for (NSString *str in array) { 109 | [self.dataArray addObject:str]; 110 | } 111 | [self.tableView reloadData]; 112 | } 113 | 114 | // 不排序 115 | - (void)noSort{ 116 | NSArray *array = @[@"3",@"5", @"1", @"4", @"2"]; 117 | [self.dataArray removeAllObjects]; 118 | for (NSString *str in array) { 119 | [self.dataArray addObject:str]; 120 | } 121 | [self.tableView reloadData]; 122 | } 123 | 124 | - (UIImageView *)createImageView:(NSString *)name{ 125 | return [[UIImageView alloc] initWithImage:[UIImage imageNamed:name]]; 126 | } 127 | 128 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 129 | return self.dataArray.count; 130 | } 131 | 132 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 133 | static NSString *identifier = @"cell"; 134 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 135 | if (!cell) { 136 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 137 | } 138 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 139 | cell.textLabel.text = self.dataArray[indexPath.row]; 140 | return cell; 141 | } 142 | 143 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ 144 | return 0.001; 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCWebViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCWebViewController.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/13. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface JCWebViewController : ViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/JCWebViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCWebViewController.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/13. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCWebViewController.h" 10 | #import "JCPullToSelect.h" 11 | 12 | @implementation JCWebViewController 13 | { 14 | UIWebView *_webView; 15 | NSString *_urlStr; 16 | } 17 | 18 | - (void)viewDidLoad{ 19 | [super viewDidLoad]; 20 | self.title = @"JCWebViewController"; 21 | 22 | CGFloat Y = [UIDevice currentDevice].systemVersion.floatValue < 7 ? 0 : 64; 23 | _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, Y, JCScreenWidth, JCScreenHeight - 64)]; 24 | _webView.backgroundColor = [UIColor whiteColor]; 25 | _webView.scalesPageToFit = YES; 26 | [self.view addSubview:_webView]; 27 | 28 | [self loadWebWithFilename:@"1.html"]; 29 | 30 | UILabel *labelNormal1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 14)]; 31 | labelNormal1.text = @"网页1"; 32 | [self configLabel:labelNormal1]; 33 | 34 | UILabel *labelSelected1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 14)]; 35 | labelSelected1.text = @"网页1"; 36 | labelSelected1.textColor = [UIColor whiteColor]; 37 | [self configLabel:labelSelected1]; 38 | 39 | UILabel *labelNormal2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 14)]; 40 | labelNormal2.text = @"网页2"; 41 | [self configLabel:labelNormal2]; 42 | 43 | UILabel *labelSelected2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 14)]; 44 | labelSelected2.text = @"网页2"; 45 | labelSelected2.textColor = [UIColor whiteColor]; 46 | [self configLabel:labelSelected2]; 47 | 48 | // 下拉刷新 49 | _webView.scrollView.header = [JCHeader headerWithDefaultIndex:0 ballColor:[UIColor purpleColor] normalViews:@[labelNormal1,labelNormal2] selectedViews:@[labelSelected1,labelSelected2] callback:^(JCHeader *header, NSInteger index) { 50 | // 模拟服务器请求延时(拿去用的时候请删除这段代码) 51 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 52 | if (index == 0) { 53 | [self loadWebWithFilename:@"1.html"]; 54 | } else { 55 | [self loadWebWithFilename:@"2.html"]; 56 | } 57 | // 停止刷新 58 | [header endRefreshing]; 59 | }); 60 | }]; 61 | } 62 | 63 | - (void)configLabel:(UILabel *)label{ 64 | label.textAlignment = NSTextAlignmentCenter; 65 | label.font = [UIFont systemFontOfSize:12]; 66 | label.backgroundColor = [UIColor clearColor]; 67 | } 68 | 69 | - (void)loadWebWithFilename:(NSString *)fileName{ 70 | NSURL *fileURL = [[NSBundle mainBundle] URLForResource:fileName withExtension:nil]; 71 | NSURLRequest *request = [NSURLRequest requestWithURL:fileURL]; 72 | [_webView loadRequest:request]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JCPullToSelect.h" 11 | #import "JCTableViewController.h" 12 | #import "JCCollectionViewController.h" 13 | #import "JCWebViewController.h" 14 | 15 | @interface ViewController () 16 | 17 | @property (nonatomic, strong) UITableView *tableView; 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | self.title = @"JCPullToSelect Demo"; 26 | 27 | self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds]; 28 | self.tableView.delegate = self; 29 | self.tableView.dataSource = self; 30 | [self.view addSubview:self.tableView]; 31 | } 32 | 33 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 34 | return 3; 35 | } 36 | 37 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 38 | static NSString *identifier = @"cell"; 39 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 40 | if (!cell) { 41 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 42 | } 43 | if (indexPath.row == 0) { 44 | cell.textLabel.text = @"JCTableViewController"; 45 | } else if (indexPath.row == 1) { 46 | cell.textLabel.text = @"JCCollectionViewController"; 47 | } else if (indexPath.row == 2){ 48 | cell.textLabel.text = @"JCWebViewController"; 49 | } 50 | return cell; 51 | } 52 | 53 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 54 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 55 | if (indexPath.row == 0) { 56 | [self.navigationController pushViewController:[JCTableViewController new] animated:YES]; 57 | } else if (indexPath.row == 1) { 58 | [self.navigationController pushViewController:[JCCollectionViewController new] animated:YES]; 59 | } else if (indexPath.row == 2) { 60 | [self.navigationController pushViewController:[JCWebViewController new] animated:YES]; 61 | } 62 | 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/html/1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 |

这是一个本地网页1

14 | 15 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/html/2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 |

这是一个本地网页2

14 | 15 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-master/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. 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 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-masterTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-masterTests/JCPullToSelect_masterTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCPullToSelect_masterTests.m 3 | // JCPullToSelect-masterTests 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JCPullToSelect_masterTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JCPullToSelect_masterTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-masterUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JCPullToSelect-master/JCPullToSelect-masterUITests/JCPullToSelect_masterUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCPullToSelect_masterUITests.m 3 | // JCPullToSelect-masterUITests 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JCPullToSelect_masterUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JCPullToSelect_masterUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /JCPullToSelect.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "JCPullToSelect" 3 | s.version = "1.0.1" 4 | s.summary = "Stronger than pull-to-refresh" 5 | s.homepage = "https://github.com/HJaycee/JCPullToSelect" 6 | s.license = "MIT" 7 | s.author = { "Hjaycee" => "hjaycee@163.com" } 8 | s.platform = :ios, "6.0" 9 | s.source = { :git => "https://github.com/HJaycee/JCPullToSelect.git", :tag => s.version } 10 | s.source_files = "JCPullToSelect", "JCPullToSelect/**/*.{h,m}" 11 | s.resource = "JCPullToSelect/JCPullToSelect.bundle" 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /JCPullToSelect/JCBallLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCBallLayer.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JCBallLayer : CALayer 13 | 14 | @property (nonatomic, strong) UIColor *ballColor; 15 | 16 | @property (nonatomic) CGFloat ratio; 17 | @property (nonatomic) CGFloat originX; 18 | @property (nonatomic) CGFloat originY; 19 | @property (nonatomic) CGFloat radiusWLeft; 20 | @property (nonatomic) CGFloat radiusWRight; 21 | @property (nonatomic) CGFloat radiusH; 22 | 23 | - (void)animateToNewOriginX:(CGFloat)newOriginX; 24 | 25 | - (void)refreshAnimating; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /JCPullToSelect/JCBallLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCBallLayer.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCBallLayer.h" 10 | #import "JCPullToSelect.h" 11 | 12 | @implementation JCBallLayer 13 | 14 | - (instancetype)init{ 15 | if (self = [super init]) { 16 | self.ratio = 0.551915024494; 17 | } 18 | return self; 19 | } 20 | 21 | -(id)initWithLayer:(JCBallLayer *)layer{ 22 | self = [super initWithLayer:layer]; 23 | if (self) { 24 | self.ballColor = layer.ballColor; 25 | self.ratio = layer.ratio; 26 | self.originX = layer.originX; 27 | self.originY = layer.originY; 28 | self.radiusWLeft = layer.radiusWLeft; 29 | self.radiusWRight = layer.radiusWRight; 30 | self.radiusH = layer.radiusH; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)drawInContext:(CGContextRef)ctx{ 36 | CGFloat leftX = self.originX - self.radiusWLeft; 37 | CGFloat leftY = self.originY; 38 | 39 | CGFloat topX = self.originX; 40 | CGFloat topY = self.originY - self.radiusH; 41 | CGFloat controlX1 = leftX; 42 | CGFloat controlY1 = self.originY - self.radiusH * self.ratio; 43 | CGFloat controlX2 = self.originX - self.radiusWLeft * self.ratio; 44 | CGFloat controlY2 = self.originY - self.radiusH; 45 | 46 | CGFloat rightX = self.originX + self.radiusWRight; 47 | CGFloat rightY = self.originY; 48 | CGFloat controlX3 = self.originX + self.radiusWRight * self.ratio; 49 | CGFloat controlY3 = self.originY - self.radiusH; 50 | CGFloat controlX4 = rightX; 51 | CGFloat controlY4 = self.originY - self.radiusH * self.ratio; 52 | 53 | CGFloat bottomX = self.originX; 54 | CGFloat bottomY = self.originY + self.radiusH; 55 | CGFloat controlX5 = rightX; 56 | CGFloat controlY5 = self.originY + self.radiusH * self.ratio; 57 | CGFloat controlX6 = self.originX + self.radiusWRight * self.ratio; 58 | CGFloat controlY6 = self.originY + self.radiusH; 59 | 60 | CGFloat controlX7 = self.originX - self.radiusWLeft * self.ratio; 61 | CGFloat controlY7 = self.originY + self.radiusH; 62 | CGFloat controlX8 = leftX; 63 | CGFloat controlY8 = self.originY + self.radiusH * self.ratio; 64 | 65 | UIBezierPath *path = [UIBezierPath bezierPath]; 66 | 67 | [path moveToPoint:CGPointMake(leftX, leftY)]; 68 | [path addCurveToPoint:CGPointMake(topX, topY) controlPoint1:CGPointMake(controlX1, controlY1) controlPoint2:CGPointMake(controlX2, controlY2)]; 69 | [path addCurveToPoint:CGPointMake(rightX, rightY) controlPoint1:CGPointMake(controlX3, controlY3) controlPoint2:CGPointMake(controlX4, controlY4)]; 70 | [path addCurveToPoint:CGPointMake(bottomX, bottomY) controlPoint1:CGPointMake(controlX5, controlY5) controlPoint2:CGPointMake(controlX6, controlY6)]; 71 | [path addCurveToPoint:CGPointMake(leftX, leftY) controlPoint1:CGPointMake(controlX7, controlY7) controlPoint2:CGPointMake(controlX8, controlY8)]; 72 | 73 | [path closePath]; 74 | 75 | CGContextAddPath(ctx, path.CGPath); 76 | CGContextSetFillColorWithColor(ctx, self.ballColor.CGColor); 77 | CGContextFillPath(ctx); 78 | } 79 | 80 | - (void)animateToNewOriginX:(CGFloat)newOriginX{ 81 | NSArray *keyPaths = @[@"radiusWLeft", @"radiusWRight", @"originX"]; 82 | NSArray *valuesArray = @[@[@(self.radiusWLeft),@25], 83 | @[@(self.radiusWRight),@25], 84 | @[@(self.originX),@(newOriginX)]]; 85 | 86 | for (int i = 0; i 10 | 11 | @class JCFooter; 12 | 13 | typedef void(^JCFooterCallback)(JCFooter *footer); 14 | 15 | @interface JCFooter : UIView 16 | 17 | // 创建一个上拉刷新控件 18 | + (instancetype)footerWithCallback:(JCFooterCallback)callback; 19 | 20 | // 停止下拉刷新 21 | - (void)endRefreshing; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /JCPullToSelect/JCFooter.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCFooter.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/16. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCFooter.h" 10 | #import "JCPullToSelect.h" 11 | 12 | #define FooterHeight 40 13 | 14 | @interface JCFooter () 15 | 16 | @property (nonatomic, copy) JCFooterCallback callBack; 17 | @property (nonatomic, weak) UIScrollView *superScrollView; 18 | @property (nonatomic, getter=isCanRefresh) BOOL canRefresh; 19 | @property (nonatomic, getter=isRefreshing) BOOL refreshing; 20 | @property (nonatomic, strong) UIActivityIndicatorView *aiView; 21 | @property (nonatomic, strong) UILabel *tipLabel; 22 | 23 | @end 24 | 25 | @implementation JCFooter 26 | 27 | + (instancetype)footerWithCallback:(JCFooterCallback)callback{ 28 | JCFooter *footer = [[JCFooter alloc] initWithFrame:CGRectMake(0, 0, JCScreenWidth, FooterHeight)]; 29 | footer.backgroundColor = [UIColor clearColor]; 30 | footer.callBack = callback; 31 | [footer setup]; 32 | return footer; 33 | } 34 | 35 | - (void)setup{ 36 | self.tipLabel = [[UILabel alloc] initWithFrame:self.bounds]; 37 | self.tipLabel.text = JCFooterTipReadyText; 38 | self.tipLabel.font = JCFooterTipTextFont; 39 | self.tipLabel.textColor = JCFooterTipTextColor; 40 | self.tipLabel.backgroundColor = [UIColor clearColor]; 41 | self.tipLabel.textAlignment = NSTextAlignmentCenter; 42 | [self addSubview:self.tipLabel]; 43 | 44 | self.aiView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 45 | self.aiView.center = CGPointMake(JCScreenWidth * 0.35, self.frame.size.height * 0.5); 46 | [self addSubview:self.aiView]; 47 | } 48 | 49 | - (void)willMoveToSuperview:(UIView *)newSuperview{ 50 | if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; 51 | 52 | [self removeObservers]; 53 | 54 | self.superScrollView = (UIScrollView *)newSuperview; 55 | self.superScrollView.alwaysBounceVertical = YES; 56 | 57 | [self moveFooter]; 58 | 59 | [self addObservers]; 60 | } 61 | 62 | - (void)dealloc{ 63 | [self removeObservers]; 64 | } 65 | 66 | - (void)addObservers{ 67 | NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; 68 | [self.superScrollView addObserver:self forKeyPath:@"contentOffset" options:options context:nil]; 69 | } 70 | 71 | - (void)removeObservers{ 72 | [self.superview removeObserver:self forKeyPath:@"contentOffset"]; 73 | } 74 | 75 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ 76 | if ([keyPath isEqualToString:@"contentOffset"]) { 77 | [self scrollViewContentOffsetDidChange:change]; 78 | } 79 | } 80 | 81 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{ 82 | [self moveFooter]; 83 | 84 | if (self.superScrollView.isDragging) { 85 | self.canRefresh = NO; 86 | self.refreshing = NO; 87 | self.tipLabel.text = JCFooterTipReadyText; 88 | [self.aiView stopAnimating]; 89 | } else { 90 | self.canRefresh = YES; 91 | } 92 | 93 | CGFloat contentInsetT = self.superScrollView.contentInset.top; 94 | CGFloat contentOffsetY = self.superScrollView.contentOffset.y; 95 | CGFloat rectH = self.superScrollView.frame.size.height; 96 | CGFloat contentSizeH = self.superScrollView.contentSize.height; 97 | CGFloat canScrollH = contentSizeH - (rectH - contentInsetT); 98 | CGFloat needContentOffsetY = -contentInsetT + canScrollH + FooterHeight; 99 | 100 | if (!self.canRefresh || self.refreshing || self.hidden) return; 101 | 102 | if (canScrollH > 0) { 103 | // 在屏幕外面 104 | if (contentOffsetY >= needContentOffsetY) { 105 | [self.superScrollView setContentOffset:CGPointMake(0, needContentOffsetY) animated:YES]; 106 | [self refreshing]; 107 | } 108 | } else { 109 | // 全部在屏幕里面 110 | if (canScrollH + FooterHeight > 0) { 111 | // 上拉控件在屏幕外面 112 | if (contentOffsetY >= needContentOffsetY) { 113 | [self.superScrollView setContentOffset:CGPointMake(0, needContentOffsetY) animated:YES]; 114 | [self refreshing]; 115 | } 116 | } else { 117 | // 上拉控件在屏幕里面,上拉操作完后,不改变contentOffset 118 | if (contentOffsetY >= -contentInsetT + FooterHeight) { 119 | [self refreshing]; 120 | } 121 | } 122 | } 123 | } 124 | 125 | - (void)moveFooter{ 126 | CGRect f = self.frame; 127 | f.origin.y = self.superScrollView .contentSize.height; 128 | self.frame = f; 129 | } 130 | 131 | - (void)refreshing{ 132 | self.tipLabel.text = JCFooterTipRefreshingText; 133 | self.superScrollView.userInteractionEnabled = NO; 134 | self.refreshing = YES; 135 | [self.aiView startAnimating]; 136 | self.callBack(self); 137 | } 138 | 139 | - (void)endRefreshing{ 140 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 141 | self.superScrollView.userInteractionEnabled = YES; 142 | self.tipLabel.text = JCFooterTipReadyText; 143 | [self.aiView stopAnimating]; 144 | }); 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /JCPullToSelect/JCHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // JCHeader.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class JCHeader; 12 | 13 | typedef void(^JCHeaderCallback)(JCHeader *header, NSInteger index); 14 | 15 | @interface JCHeader : UIView 16 | 17 | /** 18 | * 功能: 19 | * 创建一个下拉刷新控件 20 | * 参数: 21 | * defaultIndex:默认选中的index 22 | * ballColor:弹性球的颜色,传nil就是默认色 23 | * normalViews:非选中状态的view数组 24 | * selectedViews:选中状态的view数组 25 | * selectBlock:回调,会传回header和index,header用来调用endRefreshing方法,index用来做相应的处理 26 | */ 27 | + (instancetype)headerWithDefaultIndex:(NSInteger)defaultIndex ballColor:(UIColor *)ballColor normalViews:(NSArray *)normalViews selectedViews:(NSArray *)selectedViews callback:(JCHeaderCallback)callback; 28 | 29 | // 停止下拉刷新 30 | - (void)endRefreshing; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /JCPullToSelect/JCHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // JCHeader.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "JCHeader.h" 10 | #import "JCPullToSelect.h" 11 | 12 | // 勿改 13 | #define BallRadius 25 14 | #define BallWidth BallRadius * 2 15 | #define ViewHeight 66 16 | #define LeaveMoveRate 0.45 17 | 18 | @interface JCHeader () 19 | 20 | @property (nonatomic, weak) JCBallLayer *ballLayer; 21 | @property (nonatomic, strong) NSArray *normalViews; 22 | @property (nonatomic, strong) NSArray *selectedViews; 23 | @property (nonatomic, copy) JCHeaderCallback selectBlock; 24 | @property (nonatomic, strong) UILabel *tipLabel; 25 | @property (nonatomic, weak) UIScrollView *superScrollView; 26 | @property (nonatomic, getter=isCanRefresh) BOOL canRefresh; 27 | @property (nonatomic, getter=isRefreshing) BOOL refreshing; 28 | @property (nonatomic, strong) UIImageView *rotationView; 29 | 30 | @end 31 | 32 | static NSInteger count; 33 | static NSInteger defaultIndex; 34 | 35 | @implementation JCHeader 36 | { 37 | CGFloat margin; 38 | NSInteger index; 39 | CGFloat defaultOriginX; 40 | CGFloat defaultOriginY; 41 | CGFloat defaultRadiusH; 42 | CGFloat defaultRadiusWLeft; 43 | CGFloat defaultRadiusWRight; 44 | CGFloat originContentInsetTop; 45 | } 46 | 47 | - (instancetype)initWithFrame:(CGRect)frame ballLayerColor:(UIColor *)ballLayerColor{ 48 | if (self = [super initWithFrame:frame]) { 49 | JCBallLayer *ballLayer = [[JCBallLayer alloc] init]; 50 | ballLayer.frame = self.bounds; 51 | ballLayer.contentsScale = [UIScreen mainScreen].scale; 52 | ballLayer.ballColor = ballLayerColor; 53 | [self.layer addSublayer:ballLayer]; 54 | self.ballLayer = ballLayer; 55 | 56 | self.rotationView = [[UIImageView alloc] initWithImage:[self changeImage:JCRefreshingImage toColor:ballLayerColor]]; 57 | self.rotationView.frame = CGRectMake(0, 0, BallWidth, BallWidth); 58 | [self addSubview:self.rotationView]; 59 | self.rotationView.alpha = 0; 60 | 61 | [self initialization]; 62 | } 63 | return self; 64 | } 65 | 66 | - (UIImage *)changeImage:(UIImage *)image toColor:(UIColor *)color{ 67 | UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale); 68 | CGContextRef context = UIGraphicsGetCurrentContext(); 69 | CGContextTranslateCTM(context, 0, image.size.height); 70 | CGContextScaleCTM(context, 1.0, -1.0); 71 | CGContextSetBlendMode(context, kCGBlendModeNormal); 72 | CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height); 73 | CGContextClipToMask(context, rect, image.CGImage); 74 | [color setFill]; 75 | CGContextFillRect(context, rect); 76 | UIImage*newImage = UIGraphicsGetImageFromCurrentImageContext(); 77 | UIGraphicsEndImageContext(); 78 | return newImage; 79 | } 80 | 81 | - (void)initialization{ 82 | margin = (self.frame.size.width - BallWidth * count) / (count + 1); 83 | index = defaultIndex; 84 | 85 | defaultOriginX = BallRadius + BallWidth * index + margin * (index + 1); 86 | defaultOriginY = self.frame.size.height / 2; 87 | defaultRadiusH = BallRadius; 88 | defaultRadiusWLeft = BallRadius; 89 | defaultRadiusWRight = BallRadius; 90 | 91 | [self resetBall]; 92 | 93 | [self.ballLayer setNeedsDisplay]; 94 | } 95 | 96 | - (void)change:(CGFloat)change{ 97 | [self ifShowTipLabel]; 98 | 99 | [self moveLeftWithChange:change]; 100 | [self moveRightWithChange:change]; 101 | 102 | [self.ballLayer setNeedsDisplay]; 103 | } 104 | 105 | - (void)moveLeftWithChange:(CGFloat)change{ 106 | if (index == 0) return; 107 | CGFloat move = margin; 108 | change += defaultIndex * (margin + defaultRadiusH * 2); 109 | if (change < defaultRadiusH + margin + (defaultRadiusH * 2 + margin) * (index - 1)) { 110 | [self deformToLeftWithChange:change - margin - defaultRadiusH - (defaultRadiusH * 2 + margin) * (index - 1)]; 111 | } 112 | if (change < defaultRadiusH + margin - move + (defaultRadiusH * 2 + margin) * (index - 1)) { 113 | index --; 114 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 115 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 116 | [self resetBall]; 117 | [self hasDrag]; 118 | } 119 | } 120 | 121 | - (void)moveRightWithChange:(CGFloat)change{ 122 | if (index == count -1) return; 123 | CGFloat move = margin; 124 | change += defaultIndex * (margin + defaultRadiusH * 2); 125 | if (change > defaultRadiusH + (margin + defaultRadiusH * 2) * index) { 126 | [self deformToRightWithChange:change - defaultRadiusH - (margin + defaultRadiusH * 2) * index]; 127 | } 128 | if (change > defaultRadiusH + move + (margin + defaultRadiusH * 2) * index) { 129 | index ++; 130 | [self toggleFocusView]; 131 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 132 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 133 | [self resetBall]; 134 | [self hasDrag]; 135 | } 136 | } 137 | 138 | - (void)hasDrag{ 139 | [[NSUserDefaults standardUserDefaults] setValue:JCPullToSelectHasDragedBallValue forKey:JCPullToSelectHasDragedBall]; 140 | } 141 | 142 | - (void)resetBall{ 143 | self.ballLayer.originX = defaultOriginX; 144 | self.ballLayer.originY = defaultOriginY; 145 | self.ballLayer.radiusH = defaultRadiusH; 146 | self.ballLayer.radiusWLeft = defaultRadiusWLeft; 147 | self.ballLayer.radiusWRight = defaultRadiusWRight; 148 | [self toggleFocusView]; 149 | } 150 | 151 | - (void)toggleFocusView{ 152 | NSInteger viewCount = self.normalViews.count; 153 | for (int i = 0; i normalViews.count - 1 || di < 0) { 209 | JCLog(@"JCPullToSelect Error:defaultIndex越界"); 210 | return nil; 211 | } 212 | count = normalViews.count; 213 | defaultIndex = di; 214 | UIColor *ballColor = bc; 215 | if (!ballColor) { 216 | ballColor = JCDefaultBallColor; 217 | } 218 | JCHeader *header = [[JCHeader alloc] initWithFrame:CGRectMake(0, -ViewHeight, JCScreenWidth, ViewHeight) ballLayerColor:ballColor]; 219 | header.selectBlock = callback; 220 | [header addNormalViews:normalViews]; 221 | [header addSelectedViews:selectedViews]; 222 | return header; 223 | } 224 | 225 | - (void)willMoveToSuperview:(UIView *)newSuperview{ 226 | [super willMoveToSuperview:newSuperview]; 227 | 228 | if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; 229 | 230 | [self removeObservers]; 231 | 232 | self.superScrollView = (UIScrollView *)newSuperview; 233 | self.superScrollView.alwaysBounceVertical = YES; 234 | originContentInsetTop = self.superScrollView.contentInset.top; 235 | CGRect f = self.frame; 236 | f.origin.y -= originContentInsetTop; 237 | self.frame = f; 238 | 239 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; 240 | pan.delegate = self; 241 | [self.superScrollView addGestureRecognizer:pan]; 242 | 243 | [self addObservers]; 244 | [self addTipLabel]; 245 | } 246 | 247 | - (void)pan:(UIPanGestureRecognizer *)gestureRecognizer{ 248 | if (gestureRecognizer.state == UIGestureRecognizerStateBegan) { 249 | [self initialization]; 250 | } 251 | CGPoint point = [gestureRecognizer translationInView:self]; 252 | 253 | [self change:point.x]; 254 | } 255 | 256 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { 257 | if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) { 258 | return YES; 259 | } 260 | return NO; 261 | } 262 | 263 | - (void)dealloc{ 264 | [self removeObservers]; 265 | [self endRefreshing]; 266 | } 267 | 268 | - (void)addTipLabel{ 269 | self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -11, JCScreenWidth, 11)]; 270 | self.tipLabel.text = JCFirstUseTipText; 271 | self.tipLabel.font = [UIFont systemFontOfSize:11]; 272 | self.tipLabel.textAlignment = NSTextAlignmentCenter; 273 | self.tipLabel.backgroundColor = [UIColor clearColor]; 274 | self.tipLabel.textColor = JCFirstUseTipTextColor; 275 | [self addSubview:self.tipLabel]; 276 | } 277 | 278 | - (void)ifShowTipLabel{ 279 | NSString *value = [[NSUserDefaults standardUserDefaults] valueForKey:JCPullToSelectHasDragedBall]; 280 | self.tipLabel.hidden = [value isEqual:JCPullToSelectHasDragedBallValue] || count == 1; 281 | } 282 | 283 | - (void)addObservers{ 284 | NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; 285 | [self.superScrollView addObserver:self forKeyPath:@"contentOffset" options:options context:nil]; 286 | } 287 | 288 | - (void)removeObservers{ 289 | [self.superview removeObserver:self forKeyPath:@"contentOffset"]; 290 | } 291 | 292 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ 293 | if ([keyPath isEqualToString:@"contentOffset"]) { 294 | [self scrollViewContentOffsetDidChange:change]; 295 | } 296 | } 297 | 298 | - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{ 299 | CGFloat newContentOffsetY = self.superScrollView.contentOffset.y; 300 | 301 | self.alpha = fabs(newContentOffsetY + self.superScrollView.contentInset.top) / ViewHeight; 302 | 303 | if (self.superScrollView.isDragging) { 304 | self.canRefresh = NO; 305 | self.refreshing = NO; 306 | } else { 307 | self.canRefresh = YES; 308 | defaultOriginX = defaultRadiusH + defaultRadiusH * 2 * index + margin * (index + 1); 309 | [self.ballLayer animateToNewOriginX:defaultOriginX]; 310 | [self resetBall]; 311 | } 312 | 313 | if (newContentOffsetY < -self.superScrollView.contentInset.top - ViewHeight && self.isCanRefresh && !self.isRefreshing) { 314 | [self.superScrollView setContentOffset:CGPointMake(0, -self.superScrollView.contentInset.top - ViewHeight) animated:YES]; 315 | self.superScrollView.userInteractionEnabled = NO; 316 | self.refreshing = YES; 317 | [self refreshAnimating]; 318 | [self.superScrollView showFooter]; 319 | self.selectBlock(self, index); 320 | } 321 | } 322 | 323 | - (void)refreshAnimating{ 324 | self.rotationView.center = CGPointMake(defaultOriginX, defaultOriginY); 325 | self.rotationView.alpha = 1; 326 | self.rotationView.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0); 327 | [UIView animateWithDuration:0.25 animations:^{ 328 | self.rotationView.layer.transform = CATransform3DMakeScale(1, 1, 0); 329 | } completion:^(BOOL finished) { 330 | CABasicAnimation* rotationAnimation; 331 | rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 332 | rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ]; 333 | rotationAnimation.duration = 3; 334 | rotationAnimation.cumulative = YES; 335 | rotationAnimation.repeatCount = HUGE_VALF; 336 | [self.rotationView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; 337 | }]; 338 | 339 | [self.ballLayer refreshAnimating]; 340 | } 341 | 342 | - (void)endRefreshing{ 343 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 344 | [UIView animateWithDuration:0.2 animations:^{ 345 | self.rotationView.alpha = 0; 346 | } completion:^(BOOL finished) { 347 | [self.rotationView.layer removeAllAnimations]; 348 | [self.ballLayer removeAllAnimations]; 349 | self.superScrollView.userInteractionEnabled = YES; 350 | }]; 351 | [self.superScrollView setContentOffset:CGPointMake(0, -self.superScrollView.contentInset.top) animated:YES]; 352 | }); 353 | } 354 | 355 | @end 356 | 357 | -------------------------------------------------------------------------------- /JCPullToSelect/JCPullToSelect.bundle/jc_refresh_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_normal@2x.png -------------------------------------------------------------------------------- /JCPullToSelect/JCPullToSelect.bundle/jc_refresh_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect/JCPullToSelect.bundle/jc_refresh_selected@2x.png -------------------------------------------------------------------------------- /JCPullToSelect/JCPullToSelect.bundle/jc_refreshing@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichDaddyCashMany/JCPullToSelect/17bb8caf34c934186cb045bb2c450815498b719f/JCPullToSelect/JCPullToSelect.bundle/jc_refreshing@2x.png -------------------------------------------------------------------------------- /JCPullToSelect/JCPullToSelect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * GitHub:https://github.com/HJaycee 3 | * 邮箱:hjaycee@163.com 4 | * http://blog.csdn.net/hjaycee 5 | * 如发现框架有bug或者有任何建议或疑问都请发我邮箱,谢谢! 6 | */ 7 | 8 | #import "JCHeader.h" 9 | #import "JCBallLayer.h" 10 | #import "JCFooter.h" 11 | #import "UIScrollView+JCPullToSelect.h" 12 | 13 | #ifdef DEBUG 14 | #define JCLog(...) NSLog(__VA_ARGS__) 15 | #else 16 | #define JCLog(...) 17 | #endif 18 | 19 | #define JCPullToSelectHasDragedBall @"JCPullToSelectHasDragedBall" 20 | #define JCPullToSelectHasDragedBallValue @"1" 21 | #define JCScreenWidth [UIScreen mainScreen].bounds.size.width 22 | #define JCScreenHeight [UIScreen mainScreen].bounds.size.height 23 | #define JCColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] 24 | 25 | // 默认的刷新图片View,可以直接拿来用 26 | #define JCNormalRefreshView [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"JCPullToSelect.bundle/jc_refresh_normal"]] 27 | #define JCSelectedRefreshView [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"JCPullToSelect.bundle/jc_refresh_selected"]] 28 | // 刷新中的旋转图片 29 | #define JCRefreshingImage [UIImage imageNamed:@"JCPullToSelect.bundle/jc_refreshing"] 30 | // --------------------- 参数设置 --------------------- 31 | 32 | // 第一次拖拽弹性球前的提示语,拖动过以后都不会再显示(第一次也不需要显示请设置空内容) 33 | #define JCFirstUseTipText @"继续左右拖动可选择其他功能" 34 | #define JCFirstUseTipTextColor JCColor(57,57,57) 35 | // 默认弹性球颜色 36 | #define JCDefaultBallColor JCColor(51,133,255) 37 | // 上拉刷新文字 38 | #define JCFooterTipReadyText @"上拉加载" 39 | #define JCFooterTipRefreshingText @"正在加载" 40 | #define JCFooterTipTextColor JCColor(57,57,57) 41 | #define JCFooterTipTextFont [UIFont systemFontOfSize:16] 42 | 43 | -------------------------------------------------------------------------------- /JCPullToSelect/UIScrollView+JCPullToSelect.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+JCPullToSelect.h 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JCHeader.h" 11 | #import "JCFooter.h" 12 | 13 | @interface UIScrollView (JCPullToSelect) 14 | 15 | @property (nonatomic, strong) JCHeader *header; 16 | @property (nonatomic, strong) JCFooter *footer; 17 | 18 | - (void)showFooter; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JCPullToSelect/UIScrollView+JCPullToSelect.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+JCPullToSelect.m 3 | // JCPullToSelect-master 4 | // 5 | // Created by mac on 15/11/12. 6 | // Copyright © 2015年 HJaycee. All rights reserved. 7 | // 8 | 9 | #import "UIScrollView+JCPullToSelect.h" 10 | #import 11 | 12 | @implementation UIScrollView (JCPullToSelect) 13 | 14 | static const char JCHeaderKey = '\0'; 15 | - (void)setHeader:(JCHeader *)header{ 16 | if (header != self.header) { 17 | [self.header removeFromSuperview]; 18 | [self addSubview:header]; 19 | 20 | [self willChangeValueForKey:@"header"]; 21 | objc_setAssociatedObject(self, &JCHeaderKey, header, OBJC_ASSOCIATION_ASSIGN); 22 | [self didChangeValueForKey:@"header"]; 23 | } 24 | } 25 | 26 | - (JCHeader *)header 27 | { 28 | return objc_getAssociatedObject(self, &JCHeaderKey); 29 | } 30 | 31 | static const char JCFooterKey = '\0'; 32 | - (void)setFooter:(JCFooter *)footer{ 33 | if (footer != self.footer) { 34 | [self.footer removeFromSuperview]; 35 | [self addSubview:footer]; 36 | 37 | [self willChangeValueForKey:@"footer"]; 38 | objc_setAssociatedObject(self, &JCFooterKey, footer, OBJC_ASSOCIATION_ASSIGN); 39 | [self didChangeValueForKey:@"footer"]; 40 | } 41 | } 42 | 43 | - (JCFooter *)footer 44 | { 45 | return objc_getAssociatedObject(self, &JCFooterKey); 46 | } 47 | 48 | - (void)showFooter{ 49 | self.footer.hidden = NO; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JCPullToSelect 2 | 3 | # 动图演示 4 | 5 | ![(logo)](http://img1.ph.126.net/Fit3r5t098GhrKmoAUfq3Q==/630785422826569864.gif) 6 | 7 | # 功能介绍 8 | 9 | * 下拉后继续左右滑动手指可以选择其他功能 10 | * 上拉刷新 11 | * 拖动过程中实时改变弹性球外形效果真实 12 | * 可以自定义功能view数量、默认功能view的index、弹性球颜色等 13 | * 支持tableView、collectionView、webView 14 | * 最低支持iOS6 15 | * 一行代码调用 16 | 17 | # 如何使用? 18 | 19 | ## 1 使用CocoaPods导入 20 | 21 | #### 在Podfile增加一行:`pod 'JCPullToSelect'` 22 | 23 | ## 2 手动导入 24 | 25 | #### 复制 `JCPullToSelect` 文件夹到你的工程中 26 | 27 | 28 | #### 导入完成后请看以下示例代码或直接下载demo文件(推荐下载demo,更详细) 29 | 30 | ```objc 31 | self.tableView.header = [JCHeader headerWithDefaultIndex:0 ballColor:nil normalViews:@[JCNormalRefreshView] selectedViews:@[JCSelectedRefreshView] callback:^(JCHeader *header, NSInteger index) { 32 | // 停止刷新 33 | [header endRefreshing]; 34 | }]; 35 | 36 | self.tableView.footer = [JCFooter footerWithCallback:^(JCFooter *footer) { 37 | // 停止刷新 38 | [footer endRefreshing]; 39 | }]; 40 | ``` 41 | 42 | # 联系方式 43 | 44 | #### 邮箱 : hjaycee@163.com 45 | #### 博客 : http://blog.csdn.net/hjaycee 46 | #### 如发现框架有bug或者有任何建议或疑问都请发我邮箱,谢谢! 47 | --------------------------------------------------------------------------------