├── .gitignore ├── LICENSE ├── README.md ├── SUTableView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── SUTableView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets ├── 123.imageset │ ├── 123.png │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── LiveCell.h ├── LiveCell.m ├── LiveCell.xib ├── SUTableView ├── SUTableView.h ├── SUTableView.m ├── SUTableViewInterceptor.h └── SUTableViewInterceptor.m ├── ViewController.h ├── ViewController.m └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 KevinSu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SUTableView 2 | 无限循环滚动TableView 3 | -------------------------------------------------------------------------------- /SUTableView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2B6363B71D55CE000068D799 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363B61D55CE000068D799 /* main.m */; }; 11 | 2B6363BA1D55CE000068D799 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363B91D55CE000068D799 /* AppDelegate.m */; }; 12 | 2B6363BD1D55CE000068D799 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363BC1D55CE000068D799 /* ViewController.m */; }; 13 | 2B6363C01D55CE000068D799 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B6363BE1D55CE000068D799 /* Main.storyboard */; }; 14 | 2B6363C21D55CE000068D799 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B6363C11D55CE000068D799 /* Assets.xcassets */; }; 15 | 2B6363C51D55CE000068D799 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B6363C31D55CE000068D799 /* LaunchScreen.storyboard */; }; 16 | 2B6363D11D55CE5B0068D799 /* SUTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363CE1D55CE5B0068D799 /* SUTableView.m */; settings = {ASSET_TAGS = (); }; }; 17 | 2B6363D21D55CE5B0068D799 /* SUTableViewInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363D01D55CE5B0068D799 /* SUTableViewInterceptor.m */; settings = {ASSET_TAGS = (); }; }; 18 | 2B6363D61D55CF530068D799 /* LiveCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6363D41D55CF530068D799 /* LiveCell.m */; settings = {ASSET_TAGS = (); }; }; 19 | 2B6363D71D55CF530068D799 /* LiveCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B6363D51D55CF530068D799 /* LiveCell.xib */; settings = {ASSET_TAGS = (); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 2B6363B21D55CE000068D799 /* SUTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SUTableView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 2B6363B61D55CE000068D799 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | 2B6363B81D55CE000068D799 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 2B6363B91D55CE000068D799 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 2B6363BB1D55CE000068D799 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 28 | 2B6363BC1D55CE000068D799 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 29 | 2B6363BF1D55CE000068D799 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | 2B6363C11D55CE000068D799 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 31 | 2B6363C41D55CE000068D799 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | 2B6363C61D55CE000068D799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 2B6363CD1D55CE5B0068D799 /* SUTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTableView.h; sourceTree = ""; }; 34 | 2B6363CE1D55CE5B0068D799 /* SUTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTableView.m; sourceTree = ""; }; 35 | 2B6363CF1D55CE5B0068D799 /* SUTableViewInterceptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTableViewInterceptor.h; sourceTree = ""; }; 36 | 2B6363D01D55CE5B0068D799 /* SUTableViewInterceptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTableViewInterceptor.m; sourceTree = ""; }; 37 | 2B6363D31D55CF530068D799 /* LiveCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveCell.h; sourceTree = ""; }; 38 | 2B6363D41D55CF530068D799 /* LiveCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveCell.m; sourceTree = ""; }; 39 | 2B6363D51D55CF530068D799 /* LiveCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LiveCell.xib; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | 2B6363AF1D55CE000068D799 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | 2B6363A91D55CE000068D799 = { 54 | isa = PBXGroup; 55 | children = ( 56 | 2B6363B41D55CE000068D799 /* SUTableView */, 57 | 2B6363B31D55CE000068D799 /* Products */, 58 | ); 59 | sourceTree = ""; 60 | }; 61 | 2B6363B31D55CE000068D799 /* Products */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 2B6363B21D55CE000068D799 /* SUTableView.app */, 65 | ); 66 | name = Products; 67 | sourceTree = ""; 68 | }; 69 | 2B6363B41D55CE000068D799 /* SUTableView */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 2B6363CC1D55CE460068D799 /* SUTableView */, 73 | 2B6363B81D55CE000068D799 /* AppDelegate.h */, 74 | 2B6363B91D55CE000068D799 /* AppDelegate.m */, 75 | 2B6363BB1D55CE000068D799 /* ViewController.h */, 76 | 2B6363BC1D55CE000068D799 /* ViewController.m */, 77 | 2B6363D31D55CF530068D799 /* LiveCell.h */, 78 | 2B6363D41D55CF530068D799 /* LiveCell.m */, 79 | 2B6363D51D55CF530068D799 /* LiveCell.xib */, 80 | 2B6363BE1D55CE000068D799 /* Main.storyboard */, 81 | 2B6363C11D55CE000068D799 /* Assets.xcassets */, 82 | 2B6363C31D55CE000068D799 /* LaunchScreen.storyboard */, 83 | 2B6363C61D55CE000068D799 /* Info.plist */, 84 | 2B6363B51D55CE000068D799 /* Supporting Files */, 85 | ); 86 | path = SUTableView; 87 | sourceTree = ""; 88 | }; 89 | 2B6363B51D55CE000068D799 /* Supporting Files */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 2B6363B61D55CE000068D799 /* main.m */, 93 | ); 94 | name = "Supporting Files"; 95 | sourceTree = ""; 96 | }; 97 | 2B6363CC1D55CE460068D799 /* SUTableView */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 2B6363CD1D55CE5B0068D799 /* SUTableView.h */, 101 | 2B6363CE1D55CE5B0068D799 /* SUTableView.m */, 102 | 2B6363CF1D55CE5B0068D799 /* SUTableViewInterceptor.h */, 103 | 2B6363D01D55CE5B0068D799 /* SUTableViewInterceptor.m */, 104 | ); 105 | path = SUTableView; 106 | sourceTree = ""; 107 | }; 108 | /* End PBXGroup section */ 109 | 110 | /* Begin PBXNativeTarget section */ 111 | 2B6363B11D55CE000068D799 /* SUTableView */ = { 112 | isa = PBXNativeTarget; 113 | buildConfigurationList = 2B6363C91D55CE000068D799 /* Build configuration list for PBXNativeTarget "SUTableView" */; 114 | buildPhases = ( 115 | 2B6363AE1D55CE000068D799 /* Sources */, 116 | 2B6363AF1D55CE000068D799 /* Frameworks */, 117 | 2B6363B01D55CE000068D799 /* Resources */, 118 | ); 119 | buildRules = ( 120 | ); 121 | dependencies = ( 122 | ); 123 | name = SUTableView; 124 | productName = SUTableView; 125 | productReference = 2B6363B21D55CE000068D799 /* SUTableView.app */; 126 | productType = "com.apple.product-type.application"; 127 | }; 128 | /* End PBXNativeTarget section */ 129 | 130 | /* Begin PBXProject section */ 131 | 2B6363AA1D55CE000068D799 /* Project object */ = { 132 | isa = PBXProject; 133 | attributes = { 134 | LastUpgradeCheck = 0700; 135 | ORGANIZATIONNAME = KevinSu; 136 | TargetAttributes = { 137 | 2B6363B11D55CE000068D799 = { 138 | CreatedOnToolsVersion = 7.0; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = 2B6363AD1D55CE000068D799 /* Build configuration list for PBXProject "SUTableView" */; 143 | compatibilityVersion = "Xcode 3.2"; 144 | developmentRegion = English; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | Base, 149 | ); 150 | mainGroup = 2B6363A91D55CE000068D799; 151 | productRefGroup = 2B6363B31D55CE000068D799 /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | 2B6363B11D55CE000068D799 /* SUTableView */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | 2B6363B01D55CE000068D799 /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 2B6363C51D55CE000068D799 /* LaunchScreen.storyboard in Resources */, 166 | 2B6363D71D55CF530068D799 /* LiveCell.xib in Resources */, 167 | 2B6363C21D55CE000068D799 /* Assets.xcassets in Resources */, 168 | 2B6363C01D55CE000068D799 /* Main.storyboard in Resources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXResourcesBuildPhase section */ 173 | 174 | /* Begin PBXSourcesBuildPhase section */ 175 | 2B6363AE1D55CE000068D799 /* Sources */ = { 176 | isa = PBXSourcesBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | 2B6363BD1D55CE000068D799 /* ViewController.m in Sources */, 180 | 2B6363D61D55CF530068D799 /* LiveCell.m in Sources */, 181 | 2B6363BA1D55CE000068D799 /* AppDelegate.m in Sources */, 182 | 2B6363B71D55CE000068D799 /* main.m in Sources */, 183 | 2B6363D11D55CE5B0068D799 /* SUTableView.m in Sources */, 184 | 2B6363D21D55CE5B0068D799 /* SUTableViewInterceptor.m in Sources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXSourcesBuildPhase section */ 189 | 190 | /* Begin PBXVariantGroup section */ 191 | 2B6363BE1D55CE000068D799 /* Main.storyboard */ = { 192 | isa = PBXVariantGroup; 193 | children = ( 194 | 2B6363BF1D55CE000068D799 /* Base */, 195 | ); 196 | name = Main.storyboard; 197 | sourceTree = ""; 198 | }; 199 | 2B6363C31D55CE000068D799 /* LaunchScreen.storyboard */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | 2B6363C41D55CE000068D799 /* Base */, 203 | ); 204 | name = LaunchScreen.storyboard; 205 | sourceTree = ""; 206 | }; 207 | /* End PBXVariantGroup section */ 208 | 209 | /* Begin XCBuildConfiguration section */ 210 | 2B6363C71D55CE000068D799 /* Debug */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 215 | CLANG_CXX_LIBRARY = "libc++"; 216 | CLANG_ENABLE_MODULES = YES; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | CLANG_WARN_BOOL_CONVERSION = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_UNREACHABLE_CODE = YES; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = dwarf; 230 | ENABLE_STRICT_OBJC_MSGSEND = YES; 231 | ENABLE_TESTABILITY = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_DYNAMIC_NO_PIC = NO; 234 | GCC_NO_COMMON_BLOCKS = YES; 235 | GCC_OPTIMIZATION_LEVEL = 0; 236 | GCC_PREPROCESSOR_DEFINITIONS = ( 237 | "DEBUG=1", 238 | "$(inherited)", 239 | ); 240 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 241 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 242 | GCC_WARN_UNDECLARED_SELECTOR = YES; 243 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 244 | GCC_WARN_UNUSED_FUNCTION = YES; 245 | GCC_WARN_UNUSED_VARIABLE = YES; 246 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 247 | MTL_ENABLE_DEBUG_INFO = YES; 248 | ONLY_ACTIVE_ARCH = YES; 249 | SDKROOT = iphoneos; 250 | TARGETED_DEVICE_FAMILY = "1,2"; 251 | }; 252 | name = Debug; 253 | }; 254 | 2B6363C81D55CE000068D799 /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 274 | ENABLE_NS_ASSERTIONS = NO; 275 | ENABLE_STRICT_OBJC_MSGSEND = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Release; 291 | }; 292 | 2B6363CA1D55CE000068D799 /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | INFOPLIST_FILE = SUTableView/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | PRODUCT_BUNDLE_IDENTIFIER = com.kevinSu.SUTableView; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | }; 301 | name = Debug; 302 | }; 303 | 2B6363CB1D55CE000068D799 /* Release */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | INFOPLIST_FILE = SUTableView/Info.plist; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 309 | PRODUCT_BUNDLE_IDENTIFIER = com.kevinSu.SUTableView; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | }; 312 | name = Release; 313 | }; 314 | /* End XCBuildConfiguration section */ 315 | 316 | /* Begin XCConfigurationList section */ 317 | 2B6363AD1D55CE000068D799 /* Build configuration list for PBXProject "SUTableView" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | 2B6363C71D55CE000068D799 /* Debug */, 321 | 2B6363C81D55CE000068D799 /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | defaultConfigurationName = Release; 325 | }; 326 | 2B6363C91D55CE000068D799 /* Build configuration list for PBXNativeTarget "SUTableView" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | 2B6363CA1D55CE000068D799 /* Debug */, 330 | 2B6363CB1D55CE000068D799 /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | }; 334 | /* End XCConfigurationList section */ 335 | }; 336 | rootObject = 2B6363AA1D55CE000068D799 /* Project object */; 337 | } 338 | -------------------------------------------------------------------------------- /SUTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SUTableView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. 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 | -------------------------------------------------------------------------------- /SUTableView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SUTableView/Assets.xcassets/123.imageset/123.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaMingShen/SUTableView/60893f401b3f2e99dff69aa9fc671ae55aed43fc/SUTableView/Assets.xcassets/123.imageset/123.png -------------------------------------------------------------------------------- /SUTableView/Assets.xcassets/123.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "123.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SUTableView/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SUTableView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SUTableView/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 | -------------------------------------------------------------------------------- /SUTableView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SUTableView/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 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SUTableView/LiveCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveCell.h 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LiveCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *descLabel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SUTableView/LiveCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LiveCell.m 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. All rights reserved. 7 | // 8 | 9 | #import "LiveCell.h" 10 | 11 | @implementation LiveCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SUTableView/LiveCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /SUTableView/SUTableView/SUTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUTableView.h 3 | // ZHIBO 4 | // 5 | // Created by 万众科技 on 16/7/28. 6 | // Copyright © 2016年 WanZhong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SUTableView/SUTableView/SUTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUTableView.m 3 | // ZHIBO 4 | // 5 | // Created by 万众科技 on 16/7/28. 6 | // Copyright © 2016年 WanZhong. All rights reserved. 7 | // 8 | 9 | #import "SUTableView.h" 10 | #import "SUTableViewInterceptor.h" 11 | 12 | @interface SUTableView () 13 | 14 | @property (nonatomic, strong) SUTableViewInterceptor * dataSourceInterceptor; 15 | @property (nonatomic, assign) NSInteger actualRows; 16 | 17 | @end 18 | 19 | @implementation SUTableView 20 | 21 | #pragma mark - LayoutSubviews Override 22 | - (void)layoutSubviews { 23 | [self resetContentOffsetIfNeeded]; 24 | [super layoutSubviews]; 25 | } 26 | 27 | - (void)resetContentOffsetIfNeeded { 28 | CGPoint contentOffset = self.contentOffset; 29 | //scroll over top 30 | if (contentOffset.y < 0.0) { 31 | contentOffset.y = self.contentSize.height / 3.0; 32 | } 33 | //scroll over bottom 34 | else if (contentOffset.y >= (self.contentSize.height - self.bounds.size.height)) { 35 | contentOffset.y = self.contentSize.height / 3.0 - self.bounds.size.height; 36 | } 37 | [self setContentOffset: contentOffset]; 38 | } 39 | 40 | #pragma mark - DataSource Delegate Setter/Getter Override 41 | - (void)setDataSource:(id)dataSource { 42 | self.dataSourceInterceptor.receiver = dataSource; 43 | [super setDataSource:(id)self.dataSourceInterceptor]; 44 | } 45 | 46 | - (SUTableViewInterceptor *)dataSourceInterceptor { 47 | if (!_dataSourceInterceptor) { 48 | _dataSourceInterceptor = [[SUTableViewInterceptor alloc]init]; 49 | _dataSourceInterceptor.middleMan = self; 50 | } 51 | return _dataSourceInterceptor; 52 | } 53 | 54 | 55 | #pragma mark - Delegate Method Override 56 | - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { 57 | self.actualRows = [self.dataSourceInterceptor.receiver tableView:tableView numberOfRowsInSection:section]; 58 | return self.actualRows * 3; 59 | } 60 | 61 | - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 62 | NSIndexPath * actualIndexPath = [NSIndexPath indexPathForRow:indexPath.row % self.actualRows inSection:indexPath.section]; 63 | return [self.dataSourceInterceptor.receiver tableView:tableView cellForRowAtIndexPath:actualIndexPath]; 64 | } 65 | 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /SUTableView/SUTableView/SUTableViewInterceptor.h: -------------------------------------------------------------------------------- 1 | // 2 | // SUTableViewInterceptor.h 3 | // ZHIBO 4 | // 5 | // Created by 万众科技 on 16/7/28. 6 | // Copyright © 2016年 WanZhong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SUTableViewInterceptor : NSObject 12 | 13 | @property (nonatomic, weak) id receiver; 14 | @property (nonatomic, weak) id middleMan; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /SUTableView/SUTableView/SUTableViewInterceptor.m: -------------------------------------------------------------------------------- 1 | // 2 | // SUTableViewInterceptor.m 3 | // ZHIBO 4 | // 5 | // Created by 万众科技 on 16/7/28. 6 | // Copyright © 2016年 WanZhong. All rights reserved. 7 | // 8 | 9 | #import "SUTableViewInterceptor.h" 10 | 11 | @implementation SUTableViewInterceptor 12 | 13 | #pragma mark - forward & response override 14 | - (id)forwardingTargetForSelector:(SEL)aSelector { 15 | if ([self.middleMan respondsToSelector:aSelector]) return self.middleMan; 16 | if ([self.receiver respondsToSelector:aSelector]) return self.receiver; 17 | return [super forwardingTargetForSelector:aSelector]; 18 | } 19 | 20 | - (BOOL)respondsToSelector:(SEL)aSelector { 21 | if ([self.middleMan respondsToSelector:aSelector]) return YES; 22 | if ([self.receiver respondsToSelector:aSelector]) return YES; 23 | return [super respondsToSelector:aSelector]; 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SUTableView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SUTableView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SUTableView.h" 11 | #import "LiveCell.h" 12 | 13 | static NSString * liveCellID = @"liveCell"; 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.view addSubview:self.tableView]; 26 | 27 | } 28 | 29 | - (UITableView *)tableView { 30 | if(!_tableView) { 31 | _tableView = [[SUTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; 32 | _tableView.delegate = self; 33 | _tableView.dataSource = self; 34 | _tableView.showsVerticalScrollIndicator = NO; 35 | _tableView.rowHeight = 150.0; 36 | [_tableView registerNib:[UINib nibWithNibName:@"LiveCell" bundle:nil] forCellReuseIdentifier:liveCellID]; 37 | } 38 | return _tableView; 39 | } 40 | 41 | #pragma mark - UITableViewDataSource 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 43 | return 5; 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 47 | LiveCell * cell = [self.tableView dequeueReusableCellWithIdentifier:liveCellID]; 48 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 49 | cell.descLabel.text = [NSString stringWithFormat:@"第 %ld 个主播频道", indexPath.row + 1]; 50 | return cell; 51 | } 52 | 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /SUTableView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SUTableView 4 | // 5 | // Created by KevinSu on 16/8/6. 6 | // Copyright © 2016年 KevinSu. 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 | --------------------------------------------------------------------------------