├── BATableView.podspec ├── BATableView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── BATableView.xccheckout │ └── xcuserdata │ │ └── abel.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── BeyondAbel.xcuserdatad │ └── xcschemes │ │ ├── BATableView.xcscheme │ │ └── xcschememanagement.plist │ └── abel.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── BATableView.xcscheme │ └── xcschememanagement.plist ├── BATableView ├── AppDelegate.h ├── AppDelegate.m ├── BATableView-Info.plist ├── BATableView-Prefix.pch ├── BATableView │ ├── BATableView.h │ ├── BATableView.m │ ├── BATableViewIndex.h │ └── BATableViewIndex.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── 未标题-1.png │ │ └── 未标题-2.png ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── LICENSE ├── README.md └── batableview.png /BATableView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint BATableView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |spec| 10 | spec.name = 'BATableView' 11 | spec.version = '1.0.1' 12 | spec.license = { :type => 'MIT', :text => <<-LICENSE 13 | The MIT License (MIT) 14 | 15 | Copyright (c) 2016 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy 18 | of this software and associated documentation files (the "Software"), to deal 19 | in the Software without restriction, including without limitation the rights 20 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | copies of the Software, and to permit persons to whom the Software is 22 | furnished to do so, subject to the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be included in all 25 | copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | SOFTWARE. 34 | LICENSE 35 | } 36 | spec.homepage = 'https://github.com/beyondabel/BATableView' 37 | spec.author = { 'beyondabel' => 'beyondabel@gmail.com' } 38 | spec.summary = 'BATableView is add index TableView' 39 | spec.source = { :git => 'https://github.com/beyondabel/BATableView.git', :tag => 'v1.0.0' } 40 | spec.source_files = 'BATableView/**/*.{m,h}' 41 | spec.framework = 'SystemConfiguration' 42 | spec.platform = :ios, "7.0" 43 | spec.ios.deployment_target = "7.0" 44 | spec.requires_arc = true 45 | 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B578E1F41CAAB96800A81747 /* BATableView.m in Sources */ = {isa = PBXBuildFile; fileRef = B578E1F11CAAB96800A81747 /* BATableView.m */; }; 11 | B578E1F51CAAB96800A81747 /* BATableViewIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = B578E1F31CAAB96800A81747 /* BATableViewIndex.m */; }; 12 | B5B7494C1919D3D700640C8E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B7494B1919D3D700640C8E /* Foundation.framework */; }; 13 | B5B7494E1919D3D700640C8E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B7494D1919D3D700640C8E /* CoreGraphics.framework */; }; 14 | B5B749501919D3D700640C8E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B7494F1919D3D700640C8E /* UIKit.framework */; }; 15 | B5B749561919D3D700640C8E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B5B749541919D3D700640C8E /* InfoPlist.strings */; }; 16 | B5B749581919D3D700640C8E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B749571919D3D700640C8E /* main.m */; }; 17 | B5B7495C1919D3D700640C8E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B7495B1919D3D700640C8E /* AppDelegate.m */; }; 18 | B5B7495E1919D3D700640C8E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B5B7495D1919D3D700640C8E /* Images.xcassets */; }; 19 | B5B749651919D3D700640C8E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B749641919D3D700640C8E /* XCTest.framework */; }; 20 | B5B749661919D3D700640C8E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B7494B1919D3D700640C8E /* Foundation.framework */; }; 21 | B5B749671919D3D700640C8E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B7494F1919D3D700640C8E /* UIKit.framework */; }; 22 | B5B749831919D4FE00640C8E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B749821919D4FE00640C8E /* ViewController.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | B5B749681919D3D700640C8E /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = B5B749401919D3D700640C8E /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = B5B749471919D3D700640C8E; 31 | remoteInfo = BATableView; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | B578E1F01CAAB96800A81747 /* BATableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BATableView.h; sourceTree = ""; }; 37 | B578E1F11CAAB96800A81747 /* BATableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BATableView.m; sourceTree = ""; }; 38 | B578E1F21CAAB96800A81747 /* BATableViewIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BATableViewIndex.h; sourceTree = ""; }; 39 | B578E1F31CAAB96800A81747 /* BATableViewIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BATableViewIndex.m; sourceTree = ""; }; 40 | B5B749481919D3D700640C8E /* BATableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BATableView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | B5B7494B1919D3D700640C8E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 42 | B5B7494D1919D3D700640C8E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 43 | B5B7494F1919D3D700640C8E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 44 | B5B749531919D3D700640C8E /* BATableView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BATableView-Info.plist"; sourceTree = ""; }; 45 | B5B749551919D3D700640C8E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 46 | B5B749571919D3D700640C8E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | B5B749591919D3D700640C8E /* BATableView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BATableView-Prefix.pch"; sourceTree = ""; }; 48 | B5B7495A1919D3D700640C8E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | B5B7495B1919D3D700640C8E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | B5B7495D1919D3D700640C8E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 51 | B5B749631919D3D700640C8E /* BATableViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BATableViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | B5B749641919D3D700640C8E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 53 | B5B749811919D4FE00640C8E /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | B5B749821919D4FE00640C8E /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | /* End PBXFileReference section */ 56 | 57 | /* Begin PBXFrameworksBuildPhase section */ 58 | B5B749451919D3D700640C8E /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | B5B7494E1919D3D700640C8E /* CoreGraphics.framework in Frameworks */, 63 | B5B749501919D3D700640C8E /* UIKit.framework in Frameworks */, 64 | B5B7494C1919D3D700640C8E /* Foundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | B5B749601919D3D700640C8E /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | B5B749651919D3D700640C8E /* XCTest.framework in Frameworks */, 73 | B5B749671919D3D700640C8E /* UIKit.framework in Frameworks */, 74 | B5B749661919D3D700640C8E /* Foundation.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | B578E1EF1CAAB96800A81747 /* BATableView */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | B578E1F01CAAB96800A81747 /* BATableView.h */, 85 | B578E1F11CAAB96800A81747 /* BATableView.m */, 86 | B578E1F21CAAB96800A81747 /* BATableViewIndex.h */, 87 | B578E1F31CAAB96800A81747 /* BATableViewIndex.m */, 88 | ); 89 | path = BATableView; 90 | sourceTree = ""; 91 | }; 92 | B5B7493F1919D3D700640C8E = { 93 | isa = PBXGroup; 94 | children = ( 95 | B5B749511919D3D700640C8E /* BATableView */, 96 | B5B7494A1919D3D700640C8E /* Frameworks */, 97 | B5B749491919D3D700640C8E /* Products */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | B5B749491919D3D700640C8E /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | B5B749481919D3D700640C8E /* BATableView.app */, 105 | B5B749631919D3D700640C8E /* BATableViewTests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | B5B7494A1919D3D700640C8E /* Frameworks */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | B5B7494B1919D3D700640C8E /* Foundation.framework */, 114 | B5B7494D1919D3D700640C8E /* CoreGraphics.framework */, 115 | B5B7494F1919D3D700640C8E /* UIKit.framework */, 116 | B5B749641919D3D700640C8E /* XCTest.framework */, 117 | ); 118 | name = Frameworks; 119 | sourceTree = ""; 120 | }; 121 | B5B749511919D3D700640C8E /* BATableView */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | B578E1EF1CAAB96800A81747 /* BATableView */, 125 | B5B7495A1919D3D700640C8E /* AppDelegate.h */, 126 | B5B7495B1919D3D700640C8E /* AppDelegate.m */, 127 | B5B7495D1919D3D700640C8E /* Images.xcassets */, 128 | B5B749521919D3D700640C8E /* Supporting Files */, 129 | B5B749811919D4FE00640C8E /* ViewController.h */, 130 | B5B749821919D4FE00640C8E /* ViewController.m */, 131 | ); 132 | path = BATableView; 133 | sourceTree = ""; 134 | }; 135 | B5B749521919D3D700640C8E /* Supporting Files */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | B5B749531919D3D700640C8E /* BATableView-Info.plist */, 139 | B5B749541919D3D700640C8E /* InfoPlist.strings */, 140 | B5B749571919D3D700640C8E /* main.m */, 141 | B5B749591919D3D700640C8E /* BATableView-Prefix.pch */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | B5B749471919D3D700640C8E /* BATableView */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = B5B749741919D3D700640C8E /* Build configuration list for PBXNativeTarget "BATableView" */; 152 | buildPhases = ( 153 | B5B749441919D3D700640C8E /* Sources */, 154 | B5B749451919D3D700640C8E /* Frameworks */, 155 | B5B749461919D3D700640C8E /* Resources */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = BATableView; 162 | productName = BATableView; 163 | productReference = B5B749481919D3D700640C8E /* BATableView.app */; 164 | productType = "com.apple.product-type.application"; 165 | }; 166 | B5B749621919D3D700640C8E /* BATableViewTests */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = B5B749771919D3D700640C8E /* Build configuration list for PBXNativeTarget "BATableViewTests" */; 169 | buildPhases = ( 170 | B5B7495F1919D3D700640C8E /* Sources */, 171 | B5B749601919D3D700640C8E /* Frameworks */, 172 | B5B749611919D3D700640C8E /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | B5B749691919D3D700640C8E /* PBXTargetDependency */, 178 | ); 179 | name = BATableViewTests; 180 | productName = BATableViewTests; 181 | productReference = B5B749631919D3D700640C8E /* BATableViewTests.xctest */; 182 | productType = "com.apple.product-type.bundle.unit-test"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | B5B749401919D3D700640C8E /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastUpgradeCheck = 0700; 191 | ORGANIZATIONNAME = abel; 192 | TargetAttributes = { 193 | B5B749471919D3D700640C8E = { 194 | DevelopmentTeam = 2SP5P8ZC94; 195 | }; 196 | B5B749621919D3D700640C8E = { 197 | TestTargetID = B5B749471919D3D700640C8E; 198 | }; 199 | }; 200 | }; 201 | buildConfigurationList = B5B749431919D3D700640C8E /* Build configuration list for PBXProject "BATableView" */; 202 | compatibilityVersion = "Xcode 3.2"; 203 | developmentRegion = English; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | ); 208 | mainGroup = B5B7493F1919D3D700640C8E; 209 | productRefGroup = B5B749491919D3D700640C8E /* Products */; 210 | projectDirPath = ""; 211 | projectRoot = ""; 212 | targets = ( 213 | B5B749471919D3D700640C8E /* BATableView */, 214 | B5B749621919D3D700640C8E /* BATableViewTests */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | B5B749461919D3D700640C8E /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | B5B749561919D3D700640C8E /* InfoPlist.strings in Resources */, 225 | B5B7495E1919D3D700640C8E /* Images.xcassets in Resources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | B5B749611919D3D700640C8E /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | B5B749441919D3D700640C8E /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | B5B7495C1919D3D700640C8E /* AppDelegate.m in Sources */, 244 | B5B749581919D3D700640C8E /* main.m in Sources */, 245 | B578E1F41CAAB96800A81747 /* BATableView.m in Sources */, 246 | B5B749831919D4FE00640C8E /* ViewController.m in Sources */, 247 | B578E1F51CAAB96800A81747 /* BATableViewIndex.m in Sources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | B5B7495F1919D3D700640C8E /* Sources */ = { 252 | isa = PBXSourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | B5B749691919D3D700640C8E /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = B5B749471919D3D700640C8E /* BATableView */; 264 | targetProxy = B5B749681919D3D700640C8E /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | B5B749541919D3D700640C8E /* InfoPlist.strings */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | B5B749551919D3D700640C8E /* en */, 273 | ); 274 | name = InfoPlist.strings; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | B5B749721919D3D700640C8E /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 296 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 297 | COPY_PHASE_STRIP = NO; 298 | ENABLE_TESTABILITY = YES; 299 | GCC_C_LANGUAGE_STANDARD = gnu99; 300 | GCC_DYNAMIC_NO_PIC = NO; 301 | GCC_OPTIMIZATION_LEVEL = 0; 302 | GCC_PREPROCESSOR_DEFINITIONS = ( 303 | "DEBUG=1", 304 | "$(inherited)", 305 | ); 306 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 314 | ONLY_ACTIVE_ARCH = YES; 315 | SDKROOT = iphoneos; 316 | }; 317 | name = Debug; 318 | }; 319 | B5B749731919D3D700640C8E /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ALWAYS_SEARCH_USER_PATHS = NO; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_WARN_BOOL_CONVERSION = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INT_CONVERSION = YES; 333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 335 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 336 | COPY_PHASE_STRIP = YES; 337 | ENABLE_NS_ASSERTIONS = NO; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 346 | SDKROOT = iphoneos; 347 | VALIDATE_PRODUCT = YES; 348 | }; 349 | name = Release; 350 | }; 351 | B5B749751919D3D700640C8E /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 355 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 356 | CODE_SIGN_IDENTITY = "iPhone Developer"; 357 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 358 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 359 | GCC_PREFIX_HEADER = "BATableView/BATableView-Prefix.pch"; 360 | INFOPLIST_FILE = "BATableView/BATableView-Info.plist"; 361 | PRODUCT_BUNDLE_IDENTIFIER = "com.huoban.${PRODUCT_NAME:rfc1034identifier}"; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | PROVISIONING_PROFILE = ""; 364 | WRAPPER_EXTENSION = app; 365 | }; 366 | name = Debug; 367 | }; 368 | B5B749761919D3D700640C8E /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 372 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 373 | CODE_SIGN_IDENTITY = "iPhone Developer"; 374 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 375 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 376 | GCC_PREFIX_HEADER = "BATableView/BATableView-Prefix.pch"; 377 | INFOPLIST_FILE = "BATableView/BATableView-Info.plist"; 378 | PRODUCT_BUNDLE_IDENTIFIER = "com.huoban.${PRODUCT_NAME:rfc1034identifier}"; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | PROVISIONING_PROFILE = ""; 381 | WRAPPER_EXTENSION = app; 382 | }; 383 | name = Release; 384 | }; 385 | B5B749781919D3D700640C8E /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BATableView.app/BATableView"; 389 | FRAMEWORK_SEARCH_PATHS = ( 390 | "$(SDKROOT)/Developer/Library/Frameworks", 391 | "$(inherited)", 392 | "$(DEVELOPER_FRAMEWORKS_DIR)", 393 | ); 394 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 395 | GCC_PREFIX_HEADER = "BATableView/BATableView-Prefix.pch"; 396 | GCC_PREPROCESSOR_DEFINITIONS = ( 397 | "DEBUG=1", 398 | "$(inherited)", 399 | ); 400 | INFOPLIST_FILE = "BATableViewTests/BATableViewTests-Info.plist"; 401 | PRODUCT_NAME = "$(TARGET_NAME)"; 402 | TEST_HOST = "$(BUNDLE_LOADER)"; 403 | WRAPPER_EXTENSION = xctest; 404 | }; 405 | name = Debug; 406 | }; 407 | B5B749791919D3D700640C8E /* Release */ = { 408 | isa = XCBuildConfiguration; 409 | buildSettings = { 410 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BATableView.app/BATableView"; 411 | FRAMEWORK_SEARCH_PATHS = ( 412 | "$(SDKROOT)/Developer/Library/Frameworks", 413 | "$(inherited)", 414 | "$(DEVELOPER_FRAMEWORKS_DIR)", 415 | ); 416 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 417 | GCC_PREFIX_HEADER = "BATableView/BATableView-Prefix.pch"; 418 | INFOPLIST_FILE = "BATableViewTests/BATableViewTests-Info.plist"; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | TEST_HOST = "$(BUNDLE_LOADER)"; 421 | WRAPPER_EXTENSION = xctest; 422 | }; 423 | name = Release; 424 | }; 425 | /* End XCBuildConfiguration section */ 426 | 427 | /* Begin XCConfigurationList section */ 428 | B5B749431919D3D700640C8E /* Build configuration list for PBXProject "BATableView" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | B5B749721919D3D700640C8E /* Debug */, 432 | B5B749731919D3D700640C8E /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | B5B749741919D3D700640C8E /* Build configuration list for PBXNativeTarget "BATableView" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | B5B749751919D3D700640C8E /* Debug */, 441 | B5B749761919D3D700640C8E /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | B5B749771919D3D700640C8E /* Build configuration list for PBXNativeTarget "BATableViewTests" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | B5B749781919D3D700640C8E /* Debug */, 450 | B5B749791919D3D700640C8E /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | /* End XCConfigurationList section */ 456 | }; 457 | rootObject = B5B749401919D3D700640C8E /* Project object */; 458 | } 459 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/project.xcworkspace/xcshareddata/BATableView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 82066B15-8494-4E8E-BBCE-5CBCF760AB36 9 | IDESourceControlProjectName 10 | BATableView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 393DDC3A9546D0AC890F3B6C83863FA0ECDDD28C 14 | https://github.com/beyondabel/BATableView.git 15 | 16 | IDESourceControlProjectPath 17 | BATableView.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 393DDC3A9546D0AC890F3B6C83863FA0ECDDD28C 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/beyondabel/BATableView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 393DDC3A9546D0AC890F3B6C83863FA0ECDDD28C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 393DDC3A9546D0AC890F3B6C83863FA0ECDDD28C 36 | IDESourceControlWCCName 37 | BATableView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/project.xcworkspace/xcuserdata/abel.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beyondabel/BATableView/02a67795ef9d7f2f7750453d862ac1a1339196f7/BATableView.xcodeproj/project.xcworkspace/xcuserdata/abel.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BATableView.xcodeproj/xcuserdata/BeyondAbel.xcuserdatad/xcschemes/BATableView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/xcuserdata/BeyondAbel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BATableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B5B749471919D3D700640C8E 16 | 17 | primary 18 | 19 | 20 | B5B749621919D3D700640C8E 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/xcuserdata/abel.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/xcuserdata/abel.xcuserdatad/xcschemes/BATableView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /BATableView.xcodeproj/xcuserdata/abel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BATableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B5B749471919D3D700640C8E 16 | 17 | primary 18 | 19 | 20 | B5B749621919D3D700640C8E 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BATableView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // BATableView 4 | // 5 | // Created by abel on 14-5-7. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /BATableView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // BATableView 4 | // 5 | // Created by abel on 14-5-7. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | // Override point for customization after application launch. 18 | self.window.backgroundColor = [UIColor whiteColor]; 19 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]]; 20 | [self.window makeKeyAndVisible]; 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // 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. 27 | // 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. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 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 | { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /BATableView/BATableView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /BATableView/BATableView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /BATableView/BATableView/BATableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABELTableView.h 3 | // ABELTableViewDemo 4 | // 5 | // Created by abel on 14-4-28. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import 10 | @protocol BATableViewDelegate; 11 | 12 | @interface BATableView : UIView 13 | 14 | @property (nonatomic, strong) UITableView * tableView; 15 | @property (nonatomic, weak) id delegate; 16 | - (void)reloadData; 17 | - (void)hideFlotage; 18 | 19 | @end 20 | 21 | @protocol BATableViewDelegate 22 | 23 | - (NSArray *)sectionIndexTitlesForABELTableView:(BATableView *)tableView; 24 | - (NSString *)titleString:(NSInteger)section; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /BATableView/BATableView/BATableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABELTableView.m 3 | // ABELTableViewDemo 4 | // 5 | // Created by abel on 14-4-28. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import "BATableView.h" 10 | #import "BATableViewIndex.h" 11 | 12 | @interface BATableView() 13 | 14 | @property (nonatomic, strong) UILabel * flotageLabel; 15 | @property (nonatomic, strong) BATableViewIndex * tableViewIndex; 16 | 17 | @end 18 | 19 | @implementation BATableView 20 | 21 | - (id)initWithFrame:(CGRect)frame { 22 | self = [super initWithFrame:frame]; 23 | if (self) { 24 | // Initialization code 25 | 26 | self.tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain]; 27 | [self addSubview:self.tableView]; 28 | 29 | self.tableViewIndex = [[BATableViewIndex alloc] initWithFrame:(CGRect){self.tableView.frame.size.width - 20,0,20,frame.size.height}]; 30 | [self addSubview:self.tableViewIndex]; 31 | 32 | self.flotageLabel = [[UILabel alloc] initWithFrame:(CGRect){(self.bounds.size.width - 64 ) / 2,(self.bounds.size.height - 64) / 2,64,64}]; 33 | self.flotageLabel.backgroundColor = RGB(18, 29, 45, 0.9);//[UIColor colorWithPatternImage:[UIImage imageNamed:@"flotageBackgroud"]]; 34 | self.flotageLabel.hidden = YES; 35 | self.flotageLabel.textAlignment = NSTextAlignmentCenter; 36 | self.flotageLabel.textColor = [UIColor whiteColor]; 37 | [self addSubview:self.flotageLabel]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)setDelegate:(id)delegate { 43 | _delegate = delegate; 44 | self.tableView.delegate = delegate; 45 | self.tableView.dataSource = delegate; 46 | self.tableViewIndex.indexes = [self.delegate sectionIndexTitlesForABELTableView:self]; 47 | [self.tableViewIndex reloadLayout:self.tableView.contentInset]; 48 | self.tableViewIndex.tableViewIndexDelegate = self; 49 | } 50 | 51 | - (void)reloadData { 52 | [self.tableView reloadData]; 53 | self.tableViewIndex.indexes = [self.delegate sectionIndexTitlesForABELTableView:self]; 54 | [self.tableViewIndex reloadLayout:self.tableView.contentInset]; 55 | self.tableViewIndex.tableViewIndexDelegate = self; 56 | } 57 | 58 | - (void)hideFlotage { 59 | self.flotageLabel.hidden = YES; 60 | } 61 | 62 | #pragma mark - BATableViewIndex 63 | - (void)tableViewIndex:(BATableViewIndex *)tableViewIndex didSelectSectionAtIndex:(NSInteger)index withTitle:(NSString *)title { 64 | if (index > -1){ // for safety, should always be YES 65 | for (NSInteger i = 0; i < [self.delegate numberOfSectionsInTableView:self.tableView]; i++) { 66 | if ([[self.delegate titleString:i] isEqualToString:title]) { 67 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:i] 68 | atScrollPosition:UITableViewScrollPositionTop 69 | animated:NO]; 70 | break; 71 | } 72 | } 73 | self.flotageLabel.text = title; 74 | } 75 | } 76 | 77 | - (void)tableViewIndexTouchesBegan:(BATableViewIndex *)tableViewIndex { 78 | self.flotageLabel.hidden = NO; 79 | } 80 | 81 | - (void)tableViewIndexTouchesEnd:(BATableViewIndex *)tableViewIndex { 82 | CATransition *animation = [CATransition animation]; 83 | animation.type = kCATransitionFade; 84 | animation.duration = 0.4; 85 | [self.flotageLabel.layer addAnimation:animation forKey:nil]; 86 | 87 | self.flotageLabel.hidden = YES; 88 | } 89 | 90 | - (NSArray *)tableViewIndexTitle:(BATableViewIndex *)tableViewIndex { 91 | return [self.delegate sectionIndexTitlesForABELTableView:self]; 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /BATableView/BATableView/BATableViewIndex.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABELTableViewIndex.h 3 | // ABELTableViewDemo 4 | // 5 | // Created by abel on 14-4-28. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define RGB(r,g,b,a) [UIColor colorWithRed:(double)r/255.0f green:(double)g/255.0f blue:(double)b/255.0f alpha:a] 12 | 13 | @protocol BATableViewIndexDelegate; 14 | 15 | @interface BATableViewIndex : UIView 16 | @property (nonatomic, strong) NSArray *indexes; 17 | @property (nonatomic, weak) id tableViewIndexDelegate; 18 | 19 | - (void)reloadLayout:(UIEdgeInsets)edgeInsets; 20 | 21 | @end 22 | 23 | @protocol BATableViewIndexDelegate 24 | 25 | /** 26 | * 触摸到索引时触发 27 | * 28 | * @param tableViewIndex 触发didSelectSectionAtIndex对象 29 | * @param index 索引下标 30 | * @param title 索引文字 31 | */ 32 | - (void)tableViewIndex:(BATableViewIndex *)tableViewIndex didSelectSectionAtIndex:(NSInteger)index withTitle:(NSString *)title; 33 | 34 | /** 35 | * 开始触摸索引 36 | * 37 | * @param tableViewIndex 触发tableViewIndexTouchesBegan对象 38 | */ 39 | - (void)tableViewIndexTouchesBegan:(BATableViewIndex *)tableViewIndex; 40 | /** 41 | * 触摸索引结束 42 | * 43 | * @param tableViewIndex 44 | */ 45 | - (void)tableViewIndexTouchesEnd:(BATableViewIndex *)tableViewIndex; 46 | 47 | /** 48 | * TableView中右边右边索引title 49 | * 50 | * @param tableViewIndex 触发tableViewIndexTitle对象 51 | * 52 | * @return 索引title数组 53 | */ 54 | - (NSArray *)tableViewIndexTitle:(BATableViewIndex *)tableViewIndex; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /BATableView/BATableView/BATableViewIndex.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABELTableViewIndex.m 3 | // ABELTableViewDemo 4 | // 5 | // Created by abel on 14-4-28. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import "BATableViewIndex.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error BATableViewIndex must be built with ARC. 13 | // You can turn on ARC for only AIMTableViewIndexBar files by adding -fobjc-arc to the build phase for each of its files. 14 | #endif 15 | 16 | @interface BATableViewIndex (){ 17 | BOOL isLayedOut; 18 | CAShapeLayer *shapeLayer; 19 | CGFloat fontSize; 20 | } 21 | 22 | @property (nonatomic, strong) NSArray *letters; 23 | @property (nonatomic, assign) CGFloat letterHeight; 24 | 25 | @end 26 | 27 | 28 | @implementation BATableViewIndex 29 | 30 | - (id)initWithFrame:(CGRect)frame{ 31 | if (self = [super initWithFrame:frame]) { 32 | self.backgroundColor = [UIColor clearColor]; 33 | 34 | if (frame.size.height > 480) { 35 | self.letterHeight = 14; 36 | fontSize = 12; 37 | } else { 38 | self.letterHeight = 12; 39 | fontSize = 11; 40 | } 41 | } 42 | return self; 43 | } 44 | 45 | - (void)setup{ 46 | shapeLayer = [CAShapeLayer layer]; 47 | shapeLayer.lineWidth = 1.0f; 48 | shapeLayer.fillColor = [UIColor clearColor].CGColor; 49 | shapeLayer.lineJoin = kCALineCapSquare; 50 | shapeLayer.strokeColor = [[UIColor clearColor] CGColor]; 51 | shapeLayer.strokeEnd = 1.0f; 52 | self.layer.masksToBounds = NO; 53 | } 54 | 55 | - (void)setTableViewIndexDelegate:(id)tableViewIndexDelegate 56 | { 57 | _tableViewIndexDelegate = tableViewIndexDelegate; 58 | self.letters = [self.tableViewIndexDelegate tableViewIndexTitle:self]; 59 | isLayedOut = NO; 60 | 61 | [self setNeedsLayout]; 62 | [self layoutIfNeeded]; 63 | } 64 | 65 | - (void)layoutSubviews{ 66 | [super layoutSubviews]; 67 | [self setup]; 68 | 69 | if (!isLayedOut){ 70 | 71 | [self.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)]; 72 | 73 | shapeLayer.frame = (CGRect) {.origin = CGPointZero, .size = self.layer.frame.size}; 74 | UIBezierPath *bezierPath = [UIBezierPath bezierPath]; 75 | [bezierPath moveToPoint:CGPointZero]; 76 | [bezierPath addLineToPoint:CGPointMake(0, self.frame.size.height)]; 77 | 78 | [self.letters enumerateObjectsUsingBlock:^(NSString *letter, NSUInteger idx, BOOL *stop) { 79 | CGFloat originY = idx * self.letterHeight; 80 | CATextLayer *ctl = [self textLayerWithSize:fontSize 81 | string:letter 82 | andFrame:CGRectMake(0, originY, self.frame.size.width, self.letterHeight)]; 83 | [self.layer addSublayer:ctl]; 84 | [bezierPath moveToPoint:CGPointMake(0, originY)]; 85 | [bezierPath addLineToPoint:CGPointMake(ctl.frame.size.width, originY)]; 86 | }]; 87 | 88 | shapeLayer.path = bezierPath.CGPath; 89 | [self.layer addSublayer:shapeLayer]; 90 | 91 | isLayedOut = YES; 92 | } 93 | } 94 | 95 | - (void)reloadLayout:(UIEdgeInsets)edgeInsets { 96 | CGRect rect = self.frame; 97 | rect.size.height = self.indexes.count * self.letterHeight; 98 | rect.origin.y = edgeInsets.top + ([self superview].bounds.size.height - edgeInsets.top - edgeInsets.bottom - rect.size.height) / 2; 99 | self.frame = rect; 100 | } 101 | 102 | - (CATextLayer*)textLayerWithSize:(CGFloat)size string:(NSString*)string andFrame:(CGRect)frame { 103 | CATextLayer *textLayer = [CATextLayer layer]; 104 | [textLayer setFont:@"ArialMT"]; 105 | [textLayer setFontSize:size]; 106 | [textLayer setFrame:frame]; 107 | [textLayer setAlignmentMode:kCAAlignmentCenter]; 108 | [textLayer setContentsScale:[[UIScreen mainScreen] scale]]; 109 | [textLayer setForegroundColor:RGB(168, 168, 168, 1).CGColor]; 110 | [textLayer setString:string]; 111 | return textLayer; 112 | } 113 | 114 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 115 | [super touchesBegan:touches withEvent:event]; 116 | [self sendEventToDelegate:event]; 117 | [self.tableViewIndexDelegate tableViewIndexTouchesBegan:self]; 118 | } 119 | 120 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 121 | [super touchesMoved:touches withEvent:event]; 122 | [self sendEventToDelegate:event]; 123 | } 124 | 125 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 126 | [self.tableViewIndexDelegate tableViewIndexTouchesEnd:self]; 127 | } 128 | 129 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 130 | [self.tableViewIndexDelegate tableViewIndexTouchesEnd:self]; 131 | } 132 | 133 | - (void)sendEventToDelegate:(UIEvent*)event{ 134 | UITouch *touch = [[event allTouches] anyObject]; 135 | CGPoint point = [touch locationInView:self]; 136 | 137 | NSInteger indx = ((NSInteger) floorf(point.y) / self.letterHeight); 138 | 139 | if (indx< 0 || indx > self.letters.count - 1) { 140 | return; 141 | } 142 | 143 | [self.tableViewIndexDelegate tableViewIndex:self didSelectSectionAtIndex:indx withTitle:self.letters[indx]]; 144 | } 145 | 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /BATableView/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /BATableView/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "未标题-1.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "667h", 16 | "filename" : "未标题-2.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "portrait", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "orientation" : "portrait", 23 | "idiom" : "iphone", 24 | "extent" : "full-screen", 25 | "minimum-system-version" : "7.0", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "orientation" : "portrait", 30 | "idiom" : "iphone", 31 | "extent" : "full-screen", 32 | "minimum-system-version" : "7.0", 33 | "subtype" : "retina4", 34 | "scale" : "2x" 35 | } 36 | ], 37 | "info" : { 38 | "version" : 1, 39 | "author" : "xcode" 40 | } 41 | } -------------------------------------------------------------------------------- /BATableView/Images.xcassets/LaunchImage.launchimage/未标题-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beyondabel/BATableView/02a67795ef9d7f2f7750453d862ac1a1339196f7/BATableView/Images.xcassets/LaunchImage.launchimage/未标题-1.png -------------------------------------------------------------------------------- /BATableView/Images.xcassets/LaunchImage.launchimage/未标题-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beyondabel/BATableView/02a67795ef9d7f2f7750453d862ac1a1339196f7/BATableView/Images.xcassets/LaunchImage.launchimage/未标题-2.png -------------------------------------------------------------------------------- /BATableView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // BATableView 4 | // 5 | // Created by abel on 14-5-7. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /BATableView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // BATableView 4 | // 5 | // Created by abel on 14-5-7. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "BATableView/BATableView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) BATableView *contactTableView; 15 | @property (nonatomic, strong) NSArray * dataSource; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | // 创建tableView 22 | - (void) createTableView { 23 | self.contactTableView = [[BATableView alloc] initWithFrame:self.view.bounds]; 24 | self.contactTableView.delegate = self; 25 | [self.view addSubview:self.contactTableView]; 26 | } 27 | 28 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 29 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 30 | if (self) { 31 | // Custom initialization 32 | self.title = @"BATableView demo"; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)viewDidLoad { 38 | [super viewDidLoad]; 39 | // Do any additional setup after loading the view. 40 | self.dataSource = @[ 41 | @{@"indexTitle": @"A",@"data":@[@"adam", @"alfred", @"ain", @"abdul", @"anastazja", @"angelica"]}, 42 | @{@"indexTitle": @"D",@"data":@[@"dennis" , @"deamon", @"destiny", @"dragon", @"dry", @"debug", @"drums"]}, 43 | @{@"indexTitle": @"F",@"data":@[@"Fredric", @"France", @"friends", @"family", @"fatish", @"funeral"]}, 44 | @{@"indexTitle": @"M",@"data":@[@"Mark", @"Madeline"]},@{@"indexTitle": @"N",@"data":@[@"Nemesis", @"nemo", @"name"]}, 45 | @{@"indexTitle": @"O",@"data":@[@"Obama", @"Oprah", @"Omen", @"OMG OMG OMG", @"O-Zone", @"Ontario"]}, 46 | @{@"indexTitle": @"Z",@"data":@[@"Zeus", @"Zebra", @"zed"]} 47 | ]; 48 | [self createTableView]; 49 | } 50 | 51 | - (void)didReceiveMemoryWarning { 52 | [super didReceiveMemoryWarning]; 53 | // Dispose of any resources that can be recreated. 54 | } 55 | 56 | - (void)viewWillDisappear:(BOOL)animated { 57 | [self.contactTableView hideFlotage]; 58 | } 59 | 60 | #pragma mark - UITableViewDataSource 61 | - (NSArray *) sectionIndexTitlesForABELTableView:(BATableView *)tableView { 62 | return @[ 63 | @"A",@"B",@"C",@"D",@"E", 64 | @"F",@"G",@"H",@"I",@"J", 65 | @"K",@"L",@"M",@"N",@"O", 66 | @"P",@"Q",@"R",@"S",@"T", 67 | @"U",@"V",@"W",@"X",@"Y", 68 | @"Z" 69 | ]; 70 | } 71 | 72 | - (NSString *)titleString:(NSInteger)section { 73 | return self.dataSource[section][@"indexTitle"]; 74 | } 75 | 76 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 77 | return self.dataSource[section][@"indexTitle"]; 78 | } 79 | 80 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { 81 | return self.dataSource.count; 82 | } 83 | 84 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 85 | return [self.dataSource[section][@"data"] count]; 86 | } 87 | 88 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 89 | NSString * cellName = @"UITableViewCell"; 90 | 91 | UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName]; 92 | if (!cell) { 93 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName]; 94 | } 95 | cell.textLabel.text = self.dataSource[indexPath.section][@"data"][indexPath.row]; 96 | return cell; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /BATableView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /BATableView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BATableView 4 | // 5 | // Created by abel on 14-5-7. 6 | // Copyright (c) 2014年 abel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BATableView 2 | =========== 3 | 4 | 欢迎关注我的博客 www.beyondabel.com 5 | 6 | BATableViewKit是自定义列表中的索引栏(Index Bar)。手指滑动 index bar 时,中间会出现黑色小浮块,并把index Bar上的字显示在黑色小浮块上,黑色小浮块上的字会随手指index bar 变换。 7 | 8 | ![image](batableview.png) 9 | 10 | ### 如何去使用BATableView 11 | 12 | 1. 创建BATableView 13 | 14 | BATableView *contactTableView = [[BATableView alloc] initWithFrame:self.view.bounds]; 15 | contactTableView.delegate = self; 16 | [self.view addSubview:self.contactTableView]; 17 | 18 | 2. 实现BATableViewDelegate、UITableViewDataSource、UITableViewDelegate协议 19 | 20 | 21 | 22 | ### License 23 | 24 | BATableView is published under MIT License 25 | -------------------------------------------------------------------------------- /batableview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beyondabel/BATableView/02a67795ef9d7f2f7750453d862ac1a1339196f7/batableview.png --------------------------------------------------------------------------------