├── ExcelViewDemo ├── ExcelViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── ghl.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── ghl.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── ExcelViewDemo.xcscheme │ │ └── xcschememanagement.plist └── ExcelViewDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_29.png │ │ ├── icon_29@2x.png │ │ ├── icon_40@2x.png │ │ ├── icon_57.png │ │ ├── icon_57@2x.png │ │ └── icon_60@2x.png │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── Default-568h@2x-1.png │ │ ├── Default-568h@2x.png │ │ ├── Default.png │ │ ├── Default@2x-1.png │ │ └── Default@2x.png │ ├── ExcelView │ ├── ExcelLockCell.h │ ├── ExcelLockCell.m │ ├── ExcelLockCell.xib │ ├── ExcelLockSection.h │ ├── ExcelLockSection.m │ ├── ExcelLockSection.xib │ ├── ExcelSection.h │ ├── ExcelSection.m │ ├── ExcelSection.xib │ ├── ExcelUnLockCell.h │ ├── ExcelUnLockCell.m │ ├── ExcelUnLockCell.xib │ ├── ExcelView.h │ ├── ExcelView.m │ ├── LockViewCell.h │ ├── LockViewCell.m │ ├── LockViewCell.xib │ ├── ScrollViewCell.h │ ├── ScrollViewCell.m │ ├── ScrollViewCell.xib │ ├── UILabel+FitWitdhAndHeight.h │ └── UILabel+FitWitdhAndHeight.m │ ├── Info.plist │ ├── PrefixHeader.pch │ ├── ViewController.h │ ├── ViewController.m │ ├── ViewController.xib │ └── main.m ├── GIF.gif └── README.md /ExcelViewDemo/ExcelViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CA0C25881E937653000DDFA0 /* ExcelLockSection.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C25871E937653000DDFA0 /* ExcelLockSection.m */; }; 11 | CA0C258A1E937668000DDFA0 /* ExcelLockSection.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C25891E937668000DDFA0 /* ExcelLockSection.xib */; }; 12 | CA0C258D1E937CC9000DDFA0 /* ExcelSection.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C258C1E937CC9000DDFA0 /* ExcelSection.m */; }; 13 | CA0C258F1E937CD9000DDFA0 /* ExcelSection.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C258E1E937CD9000DDFA0 /* ExcelSection.xib */; }; 14 | CA0C25931E938195000DDFA0 /* ExcelLockCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C25911E938195000DDFA0 /* ExcelLockCell.m */; }; 15 | CA0C25941E938195000DDFA0 /* ExcelLockCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C25921E938195000DDFA0 /* ExcelLockCell.xib */; }; 16 | CA0C259D1E9388C9000DDFA0 /* ExcelUnLockCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C259B1E9388C9000DDFA0 /* ExcelUnLockCell.m */; }; 17 | CA0C259E1E9388C9000DDFA0 /* ExcelUnLockCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C259C1E9388C9000DDFA0 /* ExcelUnLockCell.xib */; }; 18 | CA0C25A21E93891D000DDFA0 /* LockViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C25A01E93891D000DDFA0 /* LockViewCell.m */; }; 19 | CA0C25A31E93891D000DDFA0 /* LockViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C25A11E93891D000DDFA0 /* LockViewCell.xib */; }; 20 | CA0C25A71E93895E000DDFA0 /* ScrollViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C25A51E93895E000DDFA0 /* ScrollViewCell.m */; }; 21 | CA0C25A81E93895E000DDFA0 /* ScrollViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA0C25A61E93895E000DDFA0 /* ScrollViewCell.xib */; }; 22 | CA31469E1E4DAB2700EF4499 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CA31469D1E4DAB2700EF4499 /* main.m */; }; 23 | CA3146A11E4DAB2700EF4499 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CA3146A01E4DAB2700EF4499 /* AppDelegate.m */; }; 24 | CA3146A41E4DAB2700EF4499 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CA3146A31E4DAB2700EF4499 /* ViewController.m */; }; 25 | CA3146A91E4DAB2700EF4499 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CA3146A81E4DAB2700EF4499 /* Assets.xcassets */; }; 26 | CA3146B41E4DAC0D00EF4499 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CA3146B31E4DAC0D00EF4499 /* ViewController.xib */; }; 27 | CA3146C21E4DAF0800EF4499 /* ExcelView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA3146BC1E4DAF0800EF4499 /* ExcelView.m */; }; 28 | CA571C0C1E5451D900D1253B /* UILabel+FitWitdhAndHeight.m in Sources */ = {isa = PBXBuildFile; fileRef = CA571C0B1E5451D900D1253B /* UILabel+FitWitdhAndHeight.m */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | CA0C25861E937653000DDFA0 /* ExcelLockSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcelLockSection.h; sourceTree = ""; }; 33 | CA0C25871E937653000DDFA0 /* ExcelLockSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExcelLockSection.m; sourceTree = ""; }; 34 | CA0C25891E937668000DDFA0 /* ExcelLockSection.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExcelLockSection.xib; sourceTree = ""; }; 35 | CA0C258B1E937CC9000DDFA0 /* ExcelSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcelSection.h; sourceTree = ""; }; 36 | CA0C258C1E937CC9000DDFA0 /* ExcelSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExcelSection.m; sourceTree = ""; }; 37 | CA0C258E1E937CD9000DDFA0 /* ExcelSection.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExcelSection.xib; sourceTree = ""; }; 38 | CA0C25901E938195000DDFA0 /* ExcelLockCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcelLockCell.h; sourceTree = ""; }; 39 | CA0C25911E938195000DDFA0 /* ExcelLockCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExcelLockCell.m; sourceTree = ""; }; 40 | CA0C25921E938195000DDFA0 /* ExcelLockCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExcelLockCell.xib; sourceTree = ""; }; 41 | CA0C259A1E9388C9000DDFA0 /* ExcelUnLockCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcelUnLockCell.h; sourceTree = ""; }; 42 | CA0C259B1E9388C9000DDFA0 /* ExcelUnLockCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExcelUnLockCell.m; sourceTree = ""; }; 43 | CA0C259C1E9388C9000DDFA0 /* ExcelUnLockCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExcelUnLockCell.xib; sourceTree = ""; }; 44 | CA0C259F1E93891D000DDFA0 /* LockViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LockViewCell.h; sourceTree = ""; }; 45 | CA0C25A01E93891D000DDFA0 /* LockViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LockViewCell.m; sourceTree = ""; }; 46 | CA0C25A11E93891D000DDFA0 /* LockViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LockViewCell.xib; sourceTree = ""; }; 47 | CA0C25A41E93895E000DDFA0 /* ScrollViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollViewCell.h; sourceTree = ""; }; 48 | CA0C25A51E93895E000DDFA0 /* ScrollViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollViewCell.m; sourceTree = ""; }; 49 | CA0C25A61E93895E000DDFA0 /* ScrollViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ScrollViewCell.xib; sourceTree = ""; }; 50 | CA3146991E4DAB2700EF4499 /* ExcelViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExcelViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | CA31469D1E4DAB2700EF4499 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | CA31469F1E4DAB2700EF4499 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 53 | CA3146A01E4DAB2700EF4499 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 54 | CA3146A21E4DAB2700EF4499 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 55 | CA3146A31E4DAB2700EF4499 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 56 | CA3146A81E4DAB2700EF4499 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | CA3146AD1E4DAB2700EF4499 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | CA3146B31E4DAC0D00EF4499 /* ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ViewController.xib; sourceTree = ""; }; 59 | CA3146B61E4DAE8B00EF4499 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 60 | CA3146BB1E4DAF0800EF4499 /* ExcelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExcelView.h; sourceTree = ""; }; 61 | CA3146BC1E4DAF0800EF4499 /* ExcelView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExcelView.m; sourceTree = ""; }; 62 | CA571C0A1E5451D900D1253B /* UILabel+FitWitdhAndHeight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+FitWitdhAndHeight.h"; sourceTree = ""; }; 63 | CA571C0B1E5451D900D1253B /* UILabel+FitWitdhAndHeight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+FitWitdhAndHeight.m"; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | CA3146961E4DAB2700EF4499 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | CA3146901E4DAB2700EF4499 = { 78 | isa = PBXGroup; 79 | children = ( 80 | CA31469B1E4DAB2700EF4499 /* ExcelViewDemo */, 81 | CA31469A1E4DAB2700EF4499 /* Products */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | CA31469A1E4DAB2700EF4499 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | CA3146991E4DAB2700EF4499 /* ExcelViewDemo.app */, 89 | ); 90 | name = Products; 91 | sourceTree = ""; 92 | }; 93 | CA31469B1E4DAB2700EF4499 /* ExcelViewDemo */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | CA3146B71E4DAF0800EF4499 /* ExcelView */, 97 | CA31469F1E4DAB2700EF4499 /* AppDelegate.h */, 98 | CA3146A01E4DAB2700EF4499 /* AppDelegate.m */, 99 | CA3146A21E4DAB2700EF4499 /* ViewController.h */, 100 | CA3146A31E4DAB2700EF4499 /* ViewController.m */, 101 | CA3146B31E4DAC0D00EF4499 /* ViewController.xib */, 102 | CA3146A81E4DAB2700EF4499 /* Assets.xcassets */, 103 | CA3146AD1E4DAB2700EF4499 /* Info.plist */, 104 | CA31469C1E4DAB2700EF4499 /* Supporting Files */, 105 | ); 106 | path = ExcelViewDemo; 107 | sourceTree = ""; 108 | }; 109 | CA31469C1E4DAB2700EF4499 /* Supporting Files */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | CA31469D1E4DAB2700EF4499 /* main.m */, 113 | CA3146B61E4DAE8B00EF4499 /* PrefixHeader.pch */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | CA3146B71E4DAF0800EF4499 /* ExcelView */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | CA3146BB1E4DAF0800EF4499 /* ExcelView.h */, 122 | CA3146BC1E4DAF0800EF4499 /* ExcelView.m */, 123 | CA571C0A1E5451D900D1253B /* UILabel+FitWitdhAndHeight.h */, 124 | CA571C0B1E5451D900D1253B /* UILabel+FitWitdhAndHeight.m */, 125 | CA0C25861E937653000DDFA0 /* ExcelLockSection.h */, 126 | CA0C25871E937653000DDFA0 /* ExcelLockSection.m */, 127 | CA0C25891E937668000DDFA0 /* ExcelLockSection.xib */, 128 | CA0C258B1E937CC9000DDFA0 /* ExcelSection.h */, 129 | CA0C258C1E937CC9000DDFA0 /* ExcelSection.m */, 130 | CA0C258E1E937CD9000DDFA0 /* ExcelSection.xib */, 131 | CA0C25901E938195000DDFA0 /* ExcelLockCell.h */, 132 | CA0C25911E938195000DDFA0 /* ExcelLockCell.m */, 133 | CA0C25921E938195000DDFA0 /* ExcelLockCell.xib */, 134 | CA0C259A1E9388C9000DDFA0 /* ExcelUnLockCell.h */, 135 | CA0C259B1E9388C9000DDFA0 /* ExcelUnLockCell.m */, 136 | CA0C259C1E9388C9000DDFA0 /* ExcelUnLockCell.xib */, 137 | CA0C259F1E93891D000DDFA0 /* LockViewCell.h */, 138 | CA0C25A01E93891D000DDFA0 /* LockViewCell.m */, 139 | CA0C25A11E93891D000DDFA0 /* LockViewCell.xib */, 140 | CA0C25A41E93895E000DDFA0 /* ScrollViewCell.h */, 141 | CA0C25A51E93895E000DDFA0 /* ScrollViewCell.m */, 142 | CA0C25A61E93895E000DDFA0 /* ScrollViewCell.xib */, 143 | ); 144 | path = ExcelView; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | CA3146981E4DAB2700EF4499 /* ExcelViewDemo */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = CA3146B01E4DAB2700EF4499 /* Build configuration list for PBXNativeTarget "ExcelViewDemo" */; 153 | buildPhases = ( 154 | CA3146951E4DAB2700EF4499 /* Sources */, 155 | CA3146961E4DAB2700EF4499 /* Frameworks */, 156 | CA3146971E4DAB2700EF4499 /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | name = ExcelViewDemo; 163 | productName = ExcelViewDemo; 164 | productReference = CA3146991E4DAB2700EF4499 /* ExcelViewDemo.app */; 165 | productType = "com.apple.product-type.application"; 166 | }; 167 | /* End PBXNativeTarget section */ 168 | 169 | /* Begin PBXProject section */ 170 | CA3146911E4DAB2700EF4499 /* Project object */ = { 171 | isa = PBXProject; 172 | attributes = { 173 | LastUpgradeCheck = 0810; 174 | ORGANIZATIONNAME = "郭翰林"; 175 | TargetAttributes = { 176 | CA3146981E4DAB2700EF4499 = { 177 | CreatedOnToolsVersion = 8.1; 178 | DevelopmentTeam = 7BYWNXT9F3; 179 | ProvisioningStyle = Automatic; 180 | }; 181 | }; 182 | }; 183 | buildConfigurationList = CA3146941E4DAB2700EF4499 /* Build configuration list for PBXProject "ExcelViewDemo" */; 184 | compatibilityVersion = "Xcode 3.2"; 185 | developmentRegion = English; 186 | hasScannedForEncodings = 0; 187 | knownRegions = ( 188 | en, 189 | Base, 190 | ); 191 | mainGroup = CA3146901E4DAB2700EF4499; 192 | productRefGroup = CA31469A1E4DAB2700EF4499 /* Products */; 193 | projectDirPath = ""; 194 | projectRoot = ""; 195 | targets = ( 196 | CA3146981E4DAB2700EF4499 /* ExcelViewDemo */, 197 | ); 198 | }; 199 | /* End PBXProject section */ 200 | 201 | /* Begin PBXResourcesBuildPhase section */ 202 | CA3146971E4DAB2700EF4499 /* Resources */ = { 203 | isa = PBXResourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | CA0C25A31E93891D000DDFA0 /* LockViewCell.xib in Resources */, 207 | CA3146B41E4DAC0D00EF4499 /* ViewController.xib in Resources */, 208 | CA0C25941E938195000DDFA0 /* ExcelLockCell.xib in Resources */, 209 | CA0C258A1E937668000DDFA0 /* ExcelLockSection.xib in Resources */, 210 | CA0C259E1E9388C9000DDFA0 /* ExcelUnLockCell.xib in Resources */, 211 | CA0C25A81E93895E000DDFA0 /* ScrollViewCell.xib in Resources */, 212 | CA3146A91E4DAB2700EF4499 /* Assets.xcassets in Resources */, 213 | CA0C258F1E937CD9000DDFA0 /* ExcelSection.xib in Resources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | /* End PBXResourcesBuildPhase section */ 218 | 219 | /* Begin PBXSourcesBuildPhase section */ 220 | CA3146951E4DAB2700EF4499 /* Sources */ = { 221 | isa = PBXSourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | CA3146A41E4DAB2700EF4499 /* ViewController.m in Sources */, 225 | CA0C25A71E93895E000DDFA0 /* ScrollViewCell.m in Sources */, 226 | CA0C258D1E937CC9000DDFA0 /* ExcelSection.m in Sources */, 227 | CA571C0C1E5451D900D1253B /* UILabel+FitWitdhAndHeight.m in Sources */, 228 | CA0C25A21E93891D000DDFA0 /* LockViewCell.m in Sources */, 229 | CA0C25881E937653000DDFA0 /* ExcelLockSection.m in Sources */, 230 | CA0C25931E938195000DDFA0 /* ExcelLockCell.m in Sources */, 231 | CA3146C21E4DAF0800EF4499 /* ExcelView.m in Sources */, 232 | CA3146A11E4DAB2700EF4499 /* AppDelegate.m in Sources */, 233 | CA31469E1E4DAB2700EF4499 /* main.m in Sources */, 234 | CA0C259D1E9388C9000DDFA0 /* ExcelUnLockCell.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin XCBuildConfiguration section */ 241 | CA3146AE1E4DAB2700EF4499 /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 253 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INFINITE_RECURSION = YES; 257 | CLANG_WARN_INT_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = dwarf; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | ENABLE_TESTABILITY = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_DYNAMIC_NO_PIC = NO; 269 | GCC_NO_COMMON_BLOCKS = YES; 270 | GCC_OPTIMIZATION_LEVEL = 0; 271 | GCC_PREPROCESSOR_DEFINITIONS = ( 272 | "DEBUG=1", 273 | "$(inherited)", 274 | ); 275 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 276 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 277 | GCC_WARN_UNDECLARED_SELECTOR = YES; 278 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 279 | GCC_WARN_UNUSED_FUNCTION = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 282 | MTL_ENABLE_DEBUG_INFO = YES; 283 | ONLY_ACTIVE_ARCH = YES; 284 | SDKROOT = iphoneos; 285 | TARGETED_DEVICE_FAMILY = "1,2"; 286 | }; 287 | name = Debug; 288 | }; 289 | CA3146AF1E4DAB2700EF4499 /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | CLANG_ANALYZER_NONNULL = YES; 294 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 295 | CLANG_CXX_LIBRARY = "libc++"; 296 | CLANG_ENABLE_MODULES = YES; 297 | CLANG_ENABLE_OBJC_ARC = YES; 298 | CLANG_WARN_BOOL_CONVERSION = YES; 299 | CLANG_WARN_CONSTANT_CONVERSION = YES; 300 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 301 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 302 | CLANG_WARN_EMPTY_BODY = YES; 303 | CLANG_WARN_ENUM_CONVERSION = YES; 304 | CLANG_WARN_INFINITE_RECURSION = YES; 305 | CLANG_WARN_INT_CONVERSION = YES; 306 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 307 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 311 | COPY_PHASE_STRIP = NO; 312 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 313 | ENABLE_NS_ASSERTIONS = NO; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu99; 316 | GCC_NO_COMMON_BLOCKS = YES; 317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 319 | GCC_WARN_UNDECLARED_SELECTOR = YES; 320 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 321 | GCC_WARN_UNUSED_FUNCTION = YES; 322 | GCC_WARN_UNUSED_VARIABLE = YES; 323 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 324 | MTL_ENABLE_DEBUG_INFO = NO; 325 | SDKROOT = iphoneos; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | VALIDATE_PRODUCT = YES; 328 | }; 329 | name = Release; 330 | }; 331 | CA3146B11E4DAB2700EF4499 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 335 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 337 | DEVELOPMENT_TEAM = 7BYWNXT9F3; 338 | GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO; 339 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 340 | GCC_PREFIX_HEADER = ExcelViewDemo/PrefixHeader.pch; 341 | INFOPLIST_FILE = ExcelViewDemo/Info.plist; 342 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 343 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 344 | PRODUCT_BUNDLE_IDENTIFIER = com.jsnewland.ExcelViewDemo; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | PROVISIONING_PROFILE_SPECIFIER = ""; 347 | TARGETED_DEVICE_FAMILY = "1,2"; 348 | }; 349 | name = Debug; 350 | }; 351 | CA3146B21E4DAB2700EF4499 /* Release */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 355 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | DEVELOPMENT_TEAM = 7BYWNXT9F3; 358 | GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO; 359 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 360 | GCC_PREFIX_HEADER = ExcelViewDemo/PrefixHeader.pch; 361 | INFOPLIST_FILE = ExcelViewDemo/Info.plist; 362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 363 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 364 | PRODUCT_BUNDLE_IDENTIFIER = com.jsnewland.ExcelViewDemo; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | PROVISIONING_PROFILE_SPECIFIER = ""; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | }; 369 | name = Release; 370 | }; 371 | /* End XCBuildConfiguration section */ 372 | 373 | /* Begin XCConfigurationList section */ 374 | CA3146941E4DAB2700EF4499 /* Build configuration list for PBXProject "ExcelViewDemo" */ = { 375 | isa = XCConfigurationList; 376 | buildConfigurations = ( 377 | CA3146AE1E4DAB2700EF4499 /* Debug */, 378 | CA3146AF1E4DAB2700EF4499 /* Release */, 379 | ); 380 | defaultConfigurationIsVisible = 0; 381 | defaultConfigurationName = Release; 382 | }; 383 | CA3146B01E4DAB2700EF4499 /* Build configuration list for PBXNativeTarget "ExcelViewDemo" */ = { 384 | isa = XCConfigurationList; 385 | buildConfigurations = ( 386 | CA3146B11E4DAB2700EF4499 /* Debug */, 387 | CA3146B21E4DAB2700EF4499 /* Release */, 388 | ); 389 | defaultConfigurationIsVisible = 0; 390 | defaultConfigurationName = Release; 391 | }; 392 | /* End XCConfigurationList section */ 393 | }; 394 | rootObject = CA3146911E4DAB2700EF4499 /* Project object */; 395 | } 396 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo.xcodeproj/project.xcworkspace/xcuserdata/ghl.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo.xcodeproj/project.xcworkspace/xcuserdata/ghl.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo.xcodeproj/xcuserdata/ghl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo.xcodeproj/xcuserdata/ghl.xcuserdatad/xcschemes/ExcelViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo.xcodeproj/xcuserdata/ghl.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ExcelViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CA3146981E4DAB2700EF4499 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. 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 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. 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 | self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; 21 | self.window.backgroundColor=[UIColor whiteColor]; 22 | [self.window makeKeyAndVisible]; 23 | 24 | ViewController *view=[ViewController new]; 25 | view.title=@"ExcelView"; 26 | UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:view]; 27 | self.window.rootViewController=nav; 28 | return YES; 29 | } 30 | 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application { 33 | // 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. 34 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 35 | } 36 | 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | 44 | - (void)applicationWillEnterForeground:(UIApplication *)application { 45 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 46 | } 47 | 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application { 50 | // 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. 51 | } 52 | 53 | 54 | - (void)applicationWillTerminate:(UIApplication *)application { 55 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 56 | } 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "icon_29.png", 17 | "scale" : "1x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "icon_29@2x.png", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "idiom" : "iphone", 27 | "size" : "29x29", 28 | "scale" : "3x" 29 | }, 30 | { 31 | "size" : "40x40", 32 | "idiom" : "iphone", 33 | "filename" : "icon_40@2x.png", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "idiom" : "iphone", 38 | "size" : "40x40", 39 | "scale" : "3x" 40 | }, 41 | { 42 | "size" : "57x57", 43 | "idiom" : "iphone", 44 | "filename" : "icon_57.png", 45 | "scale" : "1x" 46 | }, 47 | { 48 | "size" : "57x57", 49 | "idiom" : "iphone", 50 | "filename" : "icon_57@2x.png", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "size" : "60x60", 55 | "idiom" : "iphone", 56 | "filename" : "icon_60@2x.png", 57 | "scale" : "2x" 58 | }, 59 | { 60 | "idiom" : "iphone", 61 | "size" : "60x60", 62 | "scale" : "3x" 63 | } 64 | ], 65 | "info" : { 66 | "version" : 1, 67 | "author" : "xcode" 68 | } 69 | } -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_29.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_29@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_40@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_57.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_57@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/AppIcon.appiconset/icon_60@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "filename" : "Default@2x-1.png", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "extent" : "full-screen", 13 | "idiom" : "iphone", 14 | "subtype" : "retina4", 15 | "filename" : "Default-568h@2x-1.png", 16 | "minimum-system-version" : "7.0", 17 | "orientation" : "portrait", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "orientation" : "portrait", 22 | "idiom" : "iphone", 23 | "extent" : "full-screen", 24 | "filename" : "Default.png", 25 | "scale" : "1x" 26 | }, 27 | { 28 | "orientation" : "portrait", 29 | "idiom" : "iphone", 30 | "extent" : "full-screen", 31 | "filename" : "Default@2x.png", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "orientation" : "portrait", 36 | "idiom" : "iphone", 37 | "extent" : "full-screen", 38 | "filename" : "Default-568h@2x.png", 39 | "subtype" : "retina4", 40 | "scale" : "2x" 41 | } 42 | ], 43 | "info" : { 44 | "version" : 1, 45 | "author" : "xcode" 46 | } 47 | } -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x-1.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x-1.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/ExcelViewDemo/ExcelViewDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelLockCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelLockCell.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef NSMutableArray *(^XTableDatas) (); 11 | typedef NSMutableArray *(^YTableDatas) (); 12 | typedef NSMutableArray *(^ColumeMaxWidths) (); 13 | typedef NSMutableArray *(^FristRowDatas) (); 14 | typedef NSMutableArray *(^RowMaxHeights) (); 15 | typedef BOOL (^IsLockFristRow) (); 16 | typedef UIColor *(^FristRowBackGround) (); 17 | typedef UIFont *(^LockTextFont) (); 18 | typedef UIScrollView *(^HeadScrollViewBolck)(); 19 | /** 20 | 滚动视图滑动到最左侧的Block 21 | */ 22 | typedef void (^ScrollViewToLeftBlock)(CGPoint contentOffset); 23 | /** 24 | 滚动视图滑动到最右侧的Block 25 | */ 26 | typedef void(^ScrollViewToRightBlock)(CGPoint contentOffset); 27 | @interface ExcelLockCell : UITableViewCell 28 | 29 | @property (weak, nonatomic) IBOutlet UITableView *lockViewTableView; 30 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 31 | @property (retain, nonatomic) UITableView *scrollViewTableView; 32 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *fristColumnWidth; 33 | 34 | /** 35 | 滚动视图滑动到最左侧的Block 36 | */ 37 | @property(nonatomic,copy) ScrollViewToLeftBlock mLeftblock; 38 | /** 39 | 滚动视图滑动到最右侧的Block 40 | */ 41 | @property(nonatomic,copy) ScrollViewToRightBlock mRightblock; 42 | 43 | 44 | -(void) setXTableDatas:(XTableDatas) xTableDatas; 45 | -(void) setYTableDatas:(YTableDatas) yTableDatas; 46 | -(void) setColumeMaxWidths:(ColumeMaxWidths) mColumeMaxWidths; 47 | -(void) setFristRowDatas:(FristRowDatas) mFristRowDatas; 48 | -(void) setRowMaxHeights:(RowMaxHeights) mRowMaxHeights; 49 | -(void) setIsLockFristRowBolck:(IsLockFristRow) isLockFristRow; 50 | -(void) setFristRowBackGroundBolck:(FristRowBackGround) mFristRowBackGround; 51 | -(void) setLockTextFontBolck:(LockTextFont) mTextFont; 52 | -(void) setHeadScrollView:(HeadScrollViewBolck) mHeadScrollView; 53 | -(void) initView; 54 | -(void)initViewWithScrollViewLeftBolck:(ScrollViewToLeftBlock) leftblock AndScrollViewRightBolck:(ScrollViewToRightBlock) rightblock; 55 | @end 56 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelLockCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelLockCell.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ExcelLockCell.h" 10 | #import "LockViewCell.h" 11 | #import "ScrollViewCell.h" 12 | #include 13 | @interface ExcelLockCell() 14 | @property(nonatomic,retain) NSMutableArray *mXTableDatas;//横向单行数据列表 15 | @property(nonatomic,retain) NSMutableArray *mYTableDatas;//如果锁定第一列则设置第一列数据集合 16 | @property(nonatomic,retain) NSMutableArray *mFristRowDatas;//第一行数据 17 | @property(nonatomic,retain) NSMutableArray *mColumeMaxWidths;//记录每列最大的宽度,自适应宽度 18 | @property(nonatomic,retain) NSMutableArray *mRowMaxHeights;//记录每行最大高度,自适应高度 19 | @property BOOL isLockFristRow;//是否锁第一行 20 | @property(nonatomic,retain) UIColor *fristRowBackGround;// 第一行背景颜色 21 | @property(nonatomic,retain) UIFont *textFont; 22 | @property CGFloat mScrollViewContentWidth;//滚动视图内容宽度 23 | @property CGFloat mScrollViewContentHeight;//滚动视图内容高度 24 | @property UIScrollView *mHeadScrollView;//父视图头部滚动视图 25 | @property(nonatomic,retain) NSMutableArray *mScollViews; 26 | @end 27 | 28 | @implementation ExcelLockCell 29 | - (void)awakeFromNib { 30 | [super awakeFromNib]; 31 | // Initialization code 32 | } 33 | 34 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 35 | [super setSelected:selected animated:animated]; 36 | // Configure the view for the selected state 37 | } 38 | 39 | #pragma mark 初始化 40 | -(void)initViewWithScrollViewLeftBolck:(ScrollViewToLeftBlock)leftblock AndScrollViewRightBolck:(ScrollViewToRightBlock)rightblock{ 41 | self.mLeftblock=leftblock; 42 | self.mRightblock=rightblock; 43 | [self initView]; 44 | } 45 | /** 46 | 初始化视图 47 | */ 48 | -(void) initView{ 49 | [self initData]; 50 | //重设视图 51 | self.fristColumnWidth.constant=[self.mColumeMaxWidths[0] floatValue]; 52 | self.scrollViewTableView=[[UITableView alloc]init]; 53 | self.scrollViewTableView.frame=CGRectMake(0, 0, _mScrollViewContentWidth, _mScrollViewContentHeight); 54 | self.scrollView.contentSize=CGSizeMake(self.mScrollViewContentWidth, self.mScrollViewContentHeight); 55 | self.scrollView.bounces=NO; 56 | self.scrollView.delegate=self; 57 | [self.scrollView addSubview:self.self.scrollViewTableView]; 58 | [self.mScollViews addObject:self.scrollView]; 59 | //初始化tableView 60 | self.lockViewTableView.separatorStyle=UITableViewCellSeparatorStyleNone; 61 | [self.lockViewTableView registerNib:[UINib nibWithNibName:@"LockViewCell" bundle:nil] forCellReuseIdentifier:@"LockViewCell"]; 62 | self.lockViewTableView.scrollEnabled=NO; 63 | self.lockViewTableView.delegate=self; 64 | self.lockViewTableView.dataSource=self; 65 | self.scrollViewTableView.separatorStyle=UITableViewCellSeparatorStyleNone; 66 | [self.scrollViewTableView registerNib:[UINib nibWithNibName:@"ScrollViewCell" bundle:nil] forCellReuseIdentifier:@"ScrollViewCell"]; 67 | self.scrollViewTableView.scrollEnabled=NO; 68 | self.scrollViewTableView.delegate=self; 69 | self.scrollViewTableView.dataSource=self; 70 | } 71 | /** 72 | 初始化数据 73 | */ 74 | -(void)initData{ 75 | if(self.mScollViews!=nil){ 76 | [self.mScollViews removeAllObjects]; 77 | }else{ 78 | self.mScollViews=[NSMutableArray arrayWithCapacity:10]; 79 | } 80 | if (self.isLockFristRow) { 81 | [self.mRowMaxHeights removeObjectAtIndex:0]; 82 | [self.mYTableDatas removeObjectAtIndex:0]; 83 | } 84 | self.mScrollViewContentWidth=0; 85 | self.mScrollViewContentHeight=0; 86 | for (int i=0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelLockSection.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelLockSection.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExcelLockSection : UIView 12 | @property (retain, nonatomic) IBOutlet UIView *lockView; 13 | @property (retain, nonatomic) IBOutlet UIScrollView *scrollView; 14 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lockViewWidthConstraint; 15 | @end 16 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelLockSection.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelLockSection.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ExcelLockSection.h" 10 | 11 | @implementation ExcelLockSection 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelLockSection.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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelSection.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelSection.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExcelSection : UIView 12 | @property (retain, nonatomic) IBOutlet UIScrollView *scrollView; 13 | @end 14 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelSection.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelSection.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ExcelSection.h" 10 | 11 | @implementation ExcelSection 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelSection.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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelUnLockCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelUnLockCell.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef NSMutableArray *(^XTableDatas) (); 11 | typedef NSMutableArray *(^YTableDatas) (); 12 | typedef NSMutableArray *(^ColumeMaxWidths) (); 13 | typedef NSMutableArray *(^FristRowDatas) (); 14 | typedef NSMutableArray *(^RowMaxHeights) (); 15 | typedef BOOL (^IsLockFristRow) (); 16 | typedef UIColor *(^FristRowBackGround) (); 17 | typedef UIFont *(^LockTextFont) (); 18 | typedef UIScrollView *(^HeadScrollViewBolck)(); 19 | /** 20 | 滚动视图滑动到最左侧的Block 21 | */ 22 | typedef void (^ScrollViewToLeftBlock)(CGPoint contentOffset); 23 | /** 24 | 滚动视图滑动到最右侧的Block 25 | */ 26 | typedef void(^ScrollViewToRightBlock)(CGPoint contentOffset); 27 | @interface ExcelUnLockCell : UITableViewCell 28 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 29 | @property (retain, nonatomic) UITableView *scrollViewTableView; 30 | /** 31 | 滚动视图滑动到最左侧的Block 32 | */ 33 | @property(nonatomic,copy) ScrollViewToLeftBlock mLeftblock; 34 | /** 35 | 滚动视图滑动到最右侧的Block 36 | */ 37 | @property(nonatomic,copy) ScrollViewToRightBlock mRightblock; 38 | 39 | 40 | -(void) setXTableDatas:(XTableDatas) xTableDatas; 41 | -(void) setYTableDatas:(YTableDatas) yTableDatas; 42 | -(void) setColumeMaxWidths:(ColumeMaxWidths) mColumeMaxWidths; 43 | -(void) setFristRowDatas:(FristRowDatas) mFristRowDatas; 44 | -(void) setRowMaxHeights:(RowMaxHeights) mRowMaxHeights; 45 | -(void) setIsLockFristRowBolck:(IsLockFristRow) isLockFristRow; 46 | -(void) setFristRowBackGroundBolck:(FristRowBackGround) mFristRowBackGround; 47 | -(void) setLockTextFontBolck:(LockTextFont) mTextFont; 48 | -(void) setHeadScrollView:(HeadScrollViewBolck) mHeadScrollView; 49 | -(void)initView; 50 | -(void)initViewWithScrollViewLeftBolck:(ScrollViewToLeftBlock) leftblock AndScrollViewRightBolck:(ScrollViewToRightBlock) rightblock; 51 | @end 52 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelUnLockCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelUnLockCell.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ExcelUnLockCell.h" 10 | #import "ScrollViewCell.h" 11 | #include 12 | @interface ExcelUnLockCell() 13 | @property(nonatomic,retain) NSMutableArray *mXTableDatas;//横向单行数据列表 14 | @property(nonatomic,retain) NSMutableArray *mYTableDatas;//如果锁定第一列则设置第一列数据集合 15 | @property(nonatomic,retain) NSMutableArray *mFristRowDatas;//第一行数据 16 | @property(nonatomic,retain) NSMutableArray *mColumeMaxWidths;//记录每列最大的宽度,自适应宽度 17 | @property(nonatomic,retain) NSMutableArray *mRowMaxHeights;//记录每行最大高度,自适应高度 18 | @property BOOL isLockFristRow;//是否锁第一行 19 | @property(nonatomic,retain) UIColor *fristRowBackGround;// 第一行背景颜色 20 | @property(nonatomic,retain) UIFont *textFont; 21 | @property CGFloat mScrollViewContentWidth;//滚动视图内容宽度 22 | @property CGFloat mScrollViewContentHeight;//滚动视图内容高度 23 | @property UIScrollView *mHeadScrollView;//父视图头部滚动视图 24 | @property(nonatomic,retain) NSMutableArray *mScollViews; 25 | @end 26 | 27 | @implementation ExcelUnLockCell 28 | 29 | - (void)awakeFromNib { 30 | [super awakeFromNib]; 31 | // Initialization code 32 | } 33 | 34 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 35 | [super setSelected:selected animated:animated]; 36 | 37 | // Configure the view for the selected state 38 | } 39 | #pragma mark 初始化 40 | -(void)initViewWithScrollViewLeftBolck:(ScrollViewToLeftBlock)leftblock AndScrollViewRightBolck:(ScrollViewToRightBlock)rightblock{ 41 | self.mLeftblock=leftblock; 42 | self.mRightblock=rightblock; 43 | [self initView]; 44 | } 45 | /** 46 | 初始化视图 47 | */ 48 | -(void) initView{ 49 | [self initData]; 50 | self.scrollViewTableView=[[UITableView alloc]init]; 51 | self.scrollViewTableView.separatorStyle=UITableViewCellSeparatorStyleNone; 52 | [self.scrollViewTableView registerNib:[UINib nibWithNibName:@"ScrollViewCell" bundle:nil] forCellReuseIdentifier:@"ScrollViewCell"]; 53 | self.scrollViewTableView.frame=CGRectMake(0, 0, self.mScrollViewContentWidth, self.mScrollViewContentHeight); 54 | self.scrollViewTableView.scrollEnabled=NO; 55 | self.scrollViewTableView.delegate=self; 56 | self.scrollViewTableView.dataSource=self; 57 | 58 | self.scrollView.contentSize=CGSizeMake(self.mScrollViewContentWidth, self.mScrollViewContentHeight); 59 | self.scrollView.bounces=NO; 60 | self.scrollView.delegate=self; 61 | [self.scrollView addSubview:self.scrollViewTableView]; 62 | [self.mScollViews addObject:self.scrollView]; 63 | } 64 | /** 65 | 初始化数据 66 | */ 67 | -(void)initData{ 68 | if (self.mScollViews!=nil) { 69 | [self.mScollViews removeAllObjects]; 70 | }else{ 71 | self.mScollViews=[NSMutableArray arrayWithCapacity:10]; 72 | } 73 | if (self.isLockFristRow) { 74 | [self.mRowMaxHeights removeObjectAtIndex:0]; 75 | } 76 | self.mScrollViewContentWidth=0; 77 | self.mScrollViewContentHeight=0; 78 | for (int i=0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelView.h 3 | // xjbmmcIos 4 | // 5 | // Created by 郭翰林 on 2017/2/8. 6 | // 7 | // 8 | 9 | #import 10 | #import "UILabel+FitWitdhAndHeight.h" 11 | /** 12 | 滚动视图滑动到最左侧的Block 13 | */ 14 | typedef void (^ScrollViewToLeftBlock)(CGPoint contentOffset); 15 | /** 16 | 滚动视图滑动到最右侧的Block 17 | */ 18 | typedef void(^ScrollViewToRightBlock)(CGPoint contentOffset); 19 | 20 | @interface ExcelView : UIView 21 | /** 22 | 表格主视图 23 | */ 24 | @property(nonatomic,retain) UITableView *mTableView; 25 | /** 26 | 是否锁定第一列 27 | */ 28 | @property BOOL isLockFristColumn; 29 | /** 30 | 是否锁定第一行 31 | */ 32 | @property BOOL isLockFristRow; 33 | /** 34 | 是否存在第一列列标题 35 | */ 36 | @property BOOL isColumnTitlte; 37 | /** 38 | 列标题名称(表格左上角数据) 39 | */ 40 | @property(nonatomic,copy) NSString *columnTitlte; 41 | /** 42 | 第一行表头数据(不包括表格左上角数据,只接收字符串) 43 | */ 44 | @property(nonatomic,retain) NSMutableArray *topTableHeadDatas; 45 | /** 46 | 第一列表头数据(不包括表格左上角数据,只接收字符串) 47 | 48 | */ 49 | @property(nonatomic,retain) NSMutableArray *leftTabHeadDatas; 50 | /** 51 | 表格数据(2维数组,不包括第一列和第一行数据,只接收字符串,例:@[@[],@[],....]) 52 | */ 53 | @property(nonatomic,retain) NSMutableArray *tableDatas; 54 | 55 | /** 56 | 表格数据(2维数组,每一行为一个子单元,只接受字符串,例:@[@[],@[],....] 57 | 设置该属性之后,columnTitlte、topTableHeadDatas、leftTabHeadDatas、tableDatas将被重置。 58 | */ 59 | @property(nonatomic,retain) NSMutableArray *allTableDatas; 60 | 61 | /** 62 | 设置字体 63 | */ 64 | @property(nonatomic,retain) UIFont *textFont; 65 | 66 | /** 67 | 第一行背景颜色 68 | */ 69 | @property(nonatomic,retain) UIColor *fristRowBackGround; 70 | /** 71 | 列最大宽度 72 | */ 73 | @property(nonatomic) CGFloat columnMaxWidth; 74 | /** 75 | 列最小宽度 76 | */ 77 | @property(nonatomic) CGFloat columnMinWidth; 78 | /** 79 | 显示,必须调用该方法或者调用showWith:方法,视图才会展现 80 | */ 81 | -(void)show; 82 | /** 83 | 滚动视图滑动到最左侧的Block 84 | */ 85 | @property(nonatomic,copy) ScrollViewToLeftBlock mLeftblock; 86 | /** 87 | 滚动视图滑动到最右侧的Block 88 | */ 89 | @property(nonatomic,copy) ScrollViewToRightBlock mRightblock; 90 | /** 91 | 显示,并加入滚动视图监听回调 92 | 93 | @param leftblock 滚动视图滑动到最左侧的Block 94 | @param rightblock 滚动视图滑动到最右侧的Block 95 | */ 96 | -(void)showWithLeftBlock:(ScrollViewToLeftBlock)leftblock AndWithRigthBlock:(ScrollViewToRightBlock) rightblock; 97 | @end 98 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ExcelView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelView.m 3 | // xjbmmcIos 4 | // 5 | // Created by 郭翰林 on 2017/2/8. 6 | // 7 | // 8 | 9 | #import "ExcelView.h" 10 | #import "ExcelLockSection.h" 11 | #import "ExcelSection.h" 12 | #import "ExcelLockCell.h" 13 | #import "ExcelUnLockCell.h" 14 | #include 15 | @interface ExcelView () 16 | @property(nonatomic,retain) NSMutableArray *mXTableDatas;//横向单行数据列表 17 | @property(nonatomic,retain) NSMutableArray *mYTableDatas;//如果锁定第一列则设置第一列数据集合 18 | @property(nonatomic,retain) NSMutableArray *mFristRowDatas;//第一行数据 19 | @property(nonatomic,retain) NSMutableArray *mScrollViewArray;//把所有滚动视图添加到该数组,滑动时监听位移,然后遍历数组改变偏移位置 20 | @property(nonatomic) CGPoint mContentOffset;//记录每次滚动结束之后的偏移量,防止列表重刷页面时偏移量复位。 21 | @property(nonatomic,retain) NSMutableArray *mColumeMaxWidths;//记录每列最大的宽度,自适应宽度 22 | @property(nonatomic,retain) NSMutableArray *mRowMaxHeights;//记录每行最大高度,自适应高度 23 | @property CGFloat mLockViewWidth;//记录锁定视图宽度,后面计算滚动视图是否滑到最右边 24 | @property UIScrollView *mHeadScrollView;//头部滚动视图 25 | @end 26 | 27 | @implementation ExcelView 28 | 29 | /* 30 | // Only override drawRect: if you perform custom drawing. 31 | // An empty implementation adversely affects performance during animation. 32 | - (void)drawRect:(CGRect)rect { 33 | // Drawing code 34 | } 35 | */ 36 | -(instancetype)initWithCoder:(NSCoder *)aDecoder{ 37 | if (self = [super initWithCoder:aDecoder]) { 38 | // NSLog(@"initWithCoder"); 39 | } 40 | return self; 41 | } 42 | 43 | -(instancetype)initWithFrame:(CGRect)frame{ 44 | if(self=[super initWithFrame:frame]){ 45 | // NSLog(@"initWithFrame"); 46 | [self initView]; 47 | } 48 | return self; 49 | } 50 | 51 | -(void)awakeFromNib{ 52 | [super awakeFromNib]; 53 | // NSLog(@"awakeFromNib"); 54 | [self initView]; 55 | } 56 | 57 | #pragma mark 初始化方法,设置默认值 58 | /** 59 | 初始化视图,设置默认值 60 | */ 61 | -(void)initView{ 62 | self.mTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; 63 | // NSLog(@"宽度:%f高度:%f",self.frame.size.width, self.frame.size.height); 64 | self.mTableView.tableFooterView=[UIView new]; 65 | self.mTableView.separatorStyle = UITableViewCellSeparatorStyleNone; 66 | self.mTableView.showsVerticalScrollIndicator=NO; 67 | 68 | self.mXTableDatas=[NSMutableArray arrayWithCapacity:10]; 69 | self.mYTableDatas=[NSMutableArray arrayWithCapacity:10]; 70 | self.mFristRowDatas=[NSMutableArray arrayWithCapacity:10]; 71 | self.mScrollViewArray=[NSMutableArray arrayWithCapacity:10]; 72 | self.mColumeMaxWidths=[NSMutableArray arrayWithCapacity:10]; 73 | self.mRowMaxHeights=[NSMutableArray arrayWithCapacity:10]; 74 | 75 | self.mContentOffset=CGPointMake(0, 0); 76 | self.columnTitlte=@""; 77 | self.textFont=[UIFont systemFontOfSize:17]; 78 | self.fristRowBackGround=RGB(229, 239, 254); 79 | self.columnMaxWidth=100; 80 | self.columnMinWidth=70; 81 | self.mLockViewWidth=0; 82 | [self addSubview:self.mTableView]; 83 | 84 | //添加约束,防止横屏时不能填充整个屏幕 85 | self.mTableView.translatesAutoresizingMaskIntoConstraints=NO; 86 | NSLayoutConstraint *mConstraintTop=[NSLayoutConstraint constraintWithItem:self.mTableView attribute:NSLayoutAttributeTop relatedBy:0 toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 87 | NSLayoutConstraint *mConstraintLeft=[NSLayoutConstraint constraintWithItem:self.mTableView attribute:NSLayoutAttributeLeft relatedBy:0 toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 88 | NSLayoutConstraint *mConstraintRight=[NSLayoutConstraint constraintWithItem:self.mTableView attribute:NSLayoutAttributeRight relatedBy:0 toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 89 | NSLayoutConstraint *mConstraintBottom=[NSLayoutConstraint constraintWithItem:self.mTableView attribute:NSLayoutAttributeBottom relatedBy:0 toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 90 | [self addConstraint:mConstraintTop]; 91 | [self addConstraint:mConstraintLeft]; 92 | [self addConstraint:mConstraintRight]; 93 | [self addConstraint:mConstraintBottom]; 94 | } 95 | 96 | /** 97 | 显示 98 | @param leftblock 滚动视图滑动到最左侧的Block 99 | @param rightblock 滚动视图滑动到最右侧的Block 100 | */ 101 | -(void)showWithLeftBlock:(ScrollViewToLeftBlock)leftblock AndWithRigthBlock:(ScrollViewToRightBlock)rightblock{ 102 | [self show]; 103 | self.mLeftblock=leftblock; 104 | self.mRightblock=rightblock; 105 | } 106 | /** 107 | 显示 108 | */ 109 | -(void)show{ 110 | //首先清除数据,如果再次刷新会存在,数据缓存的问题 111 | [self.mXTableDatas removeAllObjects]; 112 | [self.mYTableDatas removeAllObjects]; 113 | [self.mFristRowDatas removeAllObjects]; 114 | [self.mScrollViewArray removeAllObjects]; 115 | [self.mRowMaxHeights removeAllObjects]; 116 | [self.mColumeMaxWidths removeAllObjects]; 117 | 118 | if(self.allTableDatas!=nil&&self.allTableDatas.count>0){ 119 | //执行数据分解 120 | //清空数组 121 | if (_topTableHeadDatas!=nil) { 122 | [self.topTableHeadDatas removeAllObjects]; 123 | } 124 | if(_leftTabHeadDatas!=nil){ 125 | [self.leftTabHeadDatas removeAllObjects]; 126 | } 127 | if(_tableDatas!=nil){ 128 | [self.tableDatas removeAllObjects]; 129 | } 130 | self.topTableHeadDatas=[NSMutableArray arrayWithCapacity:10]; 131 | self.leftTabHeadDatas=[NSMutableArray arrayWithCapacity:10]; 132 | self.tableDatas=[NSMutableArray arrayWithCapacity:10]; 133 | //构造数据 134 | NSArray *fristArray=self.allTableDatas[0]; 135 | NSUInteger rownumbers=fristArray.count; 136 | for (int i=0;imaxwidth) { 197 | if(valueself.columnMinWidth &&valuemaxheight) { 237 | if (value<45) { 238 | self.mRowMaxHeights[i]=[NSNumber numberWithDouble:45]; 239 | }else{ 240 | self.mRowMaxHeights[i]=[NSNumber numberWithDouble:value]; 241 | } 242 | maxheight=[self.mRowMaxHeights[i] floatValue]; 243 | }else{ 244 | self.mRowMaxHeights[i]=[NSNumber numberWithDouble:maxheight]; 245 | } 246 | } 247 | } 248 | // NSLog(@"每行高度%@",self.mRowMaxHeights); 249 | //构造每行数据 250 | for (int i=0;i<_tableDatas.count;i++) { 251 | NSArray *rowArray=_tableDatas[i]; 252 | if(_topTableHeadDatas.count==rowArray.count){ 253 | if (_isLockFristColumn) { 254 | //如果锁定第一列数据 255 | [self.mXTableDatas addObject:rowArray]; 256 | }else{ 257 | NSString *mFristColumnTitle=[_leftTabHeadDatas objectAtIndex:i]; 258 | NSMutableArray *newRowArray=[NSMutableArray arrayWithCapacity:10]; 259 | [newRowArray addObject:mFristColumnTitle]; 260 | [newRowArray addObjectsFromArray:rowArray]; 261 | [self.mXTableDatas addObject:newRowArray]; 262 | } 263 | }else{ 264 | NSLog(@"数据非法!第一行表头数据和实际数据项单行数据个数不一致"); 265 | return; 266 | } 267 | } 268 | //构造第一列和第一行数据 269 | if(_isLockFristColumn){ 270 | //如果第一列锁定 271 | if (_isColumnTitlte) { 272 | [self.mYTableDatas addObject:_columnTitlte]; 273 | }else{ 274 | [self.mYTableDatas addObject:@""]; 275 | } 276 | [self.mYTableDatas addObjectsFromArray:_leftTabHeadDatas]; 277 | //构造第一行数据 278 | [self.mFristRowDatas addObjectsFromArray:_topTableHeadDatas]; 279 | }else{ 280 | //构造第一行数据 281 | if (_isColumnTitlte) { 282 | [self.mFristRowDatas addObject:_columnTitlte]; 283 | }else{ 284 | [self.mFristRowDatas addObject:@""]; 285 | } 286 | [self.mFristRowDatas addObjectsFromArray:_topTableHeadDatas]; 287 | } 288 | //构造视图 289 | self.mTableView.delegate=self; 290 | self.mTableView.dataSource=self; 291 | [self.mTableView reloadData]; 292 | //设置头部滚动视图 293 | if (self.isLockFristRow) { 294 | if (self.isLockFristColumn) { 295 | ExcelLockCell *cell=(ExcelLockCell *)[self.mTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 296 | [cell setHeadScrollView:^UIScrollView *{ 297 | return self.mHeadScrollView; 298 | }]; 299 | }else{ 300 | ExcelUnLockCell *cell=(ExcelUnLockCell *)[self.mTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 301 | [cell setHeadScrollView:^UIScrollView *{ 302 | return self.mHeadScrollView; 303 | }]; 304 | } 305 | } 306 | }else{ 307 | NSLog(@"数据非法!第一列表头数据和实际数据项单列数据个数不一致"); 308 | return; 309 | } 310 | }else{ 311 | NSLog(@"数据异常,请检查数据是否全部赋值!"); 312 | } 313 | // //检测数据 314 | // NSLog(@"第1行数据:%@",_mFristRowDatas); 315 | // for (int i=0; i<_mXTableDatas.count; i++) { 316 | // NSLog(@"第%d行数据:%@",i+2,_mXTableDatas[i]); 317 | // } 318 | // NSLog(@"第一列数据:%@",self.mYTableDatas); 319 | // 320 | } 321 | 322 | 323 | 324 | #pragma mark UITableViewDelegate 325 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 326 | if (_isLockFristColumn) { 327 | self.mLockViewWidth=[self.mColumeMaxWidths[0] floatValue]; 328 | ExcelLockCell *cell=(ExcelLockCell *)[[[NSBundle mainBundle]loadNibNamed:@"ExcelLockCell" owner:nil options:nil]lastObject]; 329 | //需求通过Block设值,因为第一层先绘制 330 | [cell setXTableDatas:^NSMutableArray *{ 331 | return self.mXTableDatas; 332 | }]; 333 | [cell setYTableDatas:^NSMutableArray *{ 334 | return self.mYTableDatas; 335 | }]; 336 | [cell setFristRowDatas:^NSMutableArray *{ 337 | return self.mFristRowDatas; 338 | }]; 339 | [cell setColumeMaxWidths:^NSMutableArray *{ 340 | return self.mColumeMaxWidths; 341 | }]; 342 | [cell setRowMaxHeights:^NSMutableArray *{ 343 | return self.mRowMaxHeights; 344 | }]; 345 | [cell setFristRowBackGroundBolck:^UIColor *{ 346 | return self.fristRowBackGround; 347 | }]; 348 | [cell setIsLockFristRowBolck:^BOOL{ 349 | return self.isLockFristRow; 350 | }]; 351 | [cell setLockTextFontBolck:^UIFont *{ 352 | return self.textFont; 353 | }]; 354 | //此方法调用才会绘制 355 | [cell initViewWithScrollViewLeftBolck:^(CGPoint contentOffset) { 356 | if (self.mLeftblock!=nil) { 357 | self.mLeftblock(contentOffset); 358 | } 359 | } AndScrollViewRightBolck:^(CGPoint contentOffset) { 360 | if (self.mRightblock!=nil) { 361 | self.mRightblock(contentOffset); 362 | } 363 | }]; 364 | [self.mScrollViewArray addObject:cell.scrollView]; 365 | return cell; 366 | }else{ 367 | ExcelUnLockCell *cell=(ExcelUnLockCell *)[[[NSBundle mainBundle]loadNibNamed:@"ExcelUnLockCell" owner:nil options:nil]lastObject]; 368 | //需求通过Block设值,因为第一层先绘制 369 | [cell setXTableDatas:^NSMutableArray *{ 370 | return self.mXTableDatas; 371 | }]; 372 | [cell setYTableDatas:^NSMutableArray *{ 373 | return self.mYTableDatas; 374 | }]; 375 | [cell setFristRowDatas:^NSMutableArray *{ 376 | return self.mFristRowDatas; 377 | }]; 378 | [cell setColumeMaxWidths:^NSMutableArray *{ 379 | return self.mColumeMaxWidths; 380 | }]; 381 | [cell setRowMaxHeights:^NSMutableArray *{ 382 | return self.mRowMaxHeights; 383 | }]; 384 | [cell setFristRowBackGroundBolck:^UIColor *{ 385 | return self.fristRowBackGround; 386 | }]; 387 | [cell setIsLockFristRowBolck:^BOOL{ 388 | return self.isLockFristRow; 389 | }]; 390 | [cell setLockTextFontBolck:^UIFont *{ 391 | return self.textFont; 392 | }]; 393 | //此方法调用才会绘制 394 | [cell initViewWithScrollViewLeftBolck:^(CGPoint contentOffset) { 395 | if (self.mLeftblock!=nil) { 396 | self.mLeftblock(contentOffset); 397 | } 398 | } AndScrollViewRightBolck:^(CGPoint contentOffset) { 399 | if (self.mRightblock!=nil) { 400 | self.mRightblock(contentOffset); 401 | } 402 | }]; 403 | [self.mScrollViewArray addObject:cell.scrollView]; 404 | return cell; 405 | } 406 | return nil; 407 | } 408 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 409 | return 1; 410 | } 411 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 412 | if (_isLockFristRow) { 413 | CGFloat cellHeigth=0; 414 | for (int i=1; i<_mRowMaxHeights.count; i++) { 415 | cellHeigth +=[_mRowMaxHeights[i] floatValue]; 416 | } 417 | // NSLog(@"cell高度:%f",cellHeigth); 418 | return cellHeigth; 419 | }else{ 420 | CGFloat cellHeigth=0; 421 | for (int i=0; i<_mRowMaxHeights.count; i++) { 422 | cellHeigth +=[_mRowMaxHeights[i] floatValue]; 423 | } 424 | // NSLog(@"cell高度:%f",cellHeigth); 425 | return cellHeigth; 426 | } 427 | return 0; 428 | } 429 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 430 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 431 | } 432 | 433 | -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ 434 | if(_isLockFristRow){ 435 | if(_isLockFristColumn){ 436 | //如果第一列锁定 437 | ExcelLockSection *cell=[[[NSBundle mainBundle]loadNibNamed:@"ExcelLockSection" owner:nil options:nil]lastObject]; 438 | //构造锁定视图 439 | UILabel *lockView=[[UILabel alloc]initWithFrame:CGRectMake(cell.lockView.frame.origin.x, cell.lockView.frame.origin.y,[self.mColumeMaxWidths[0] floatValue], [self.mRowMaxHeights[0] floatValue])]; 440 | lockView.text=[self.mYTableDatas objectAtIndex:0]; 441 | lockView.textColor=RGB(94, 153, 251); 442 | lockView.textAlignment=NSTextAlignmentCenter; 443 | lockView.numberOfLines=0; 444 | lockView.font=self.textFont; 445 | lockView.frame=CGRectMake(cell.lockView.frame.origin.x, cell.lockView.frame.origin.y,[self.mColumeMaxWidths[0] floatValue], [self.mRowMaxHeights[0] floatValue]); 446 | cell.lockViewWidthConstraint.constant=[self.mColumeMaxWidths[0] floatValue]; 447 | [cell.lockView addSubview:lockView]; 448 | cell.lockView.layer.borderWidth=0.6; 449 | cell.lockView.layer.borderColor=[UIColor whiteColor].CGColor; 450 | cell.lockView.layer.backgroundColor=self.fristRowBackGround.CGColor; 451 | //构造滚动视图 452 | CGFloat x=0; 453 | int i=1; 454 | for (NSString *data in self.mFristRowDatas) { 455 | UIView *view=[[UIView alloc]initWithFrame:CGRectMake(x, 0, [self.mColumeMaxWidths[i] floatValue], [self.mRowMaxHeights[0] floatValue])]; 456 | UILabel *dataView=[[UILabel alloc]initWithFrame:view.bounds]; 457 | dataView.text=data; 458 | dataView.textColor=RGB(94, 153, 251); 459 | dataView.textAlignment=NSTextAlignmentCenter; 460 | dataView.numberOfLines=0; 461 | dataView.font=self.textFont; 462 | [view addSubview:dataView]; 463 | view.layer.borderWidth=0.6; 464 | view.layer.borderColor=[UIColor whiteColor].CGColor; 465 | view.layer.backgroundColor=self.fristRowBackGround.CGColor; 466 | [cell.scrollView addSubview:view]; 467 | x+=view.frame.size.width; 468 | i++; 469 | } 470 | cell.scrollView.contentSize=CGSizeMake(x, cell.scrollView.frame.size.height); 471 | //加入滚动视图数组 472 | cell.scrollView.delegate=self; 473 | cell.scrollView.bounces=NO; 474 | cell.scrollView.contentOffset=self.mContentOffset; 475 | self.mHeadScrollView=cell.scrollView; 476 | [self.mScrollViewArray addObject:cell.scrollView]; 477 | return cell; 478 | }else{ 479 | ExcelSection *cell=[[[NSBundle mainBundle]loadNibNamed:@"ExcelSection" owner:nil options:nil]lastObject]; 480 | //构造滚动视图 481 | CGFloat x=0; 482 | int i=0; 483 | for (NSString *data in _mFristRowDatas) { 484 | UIView *view=[[UIView alloc]initWithFrame:CGRectMake(x, 0, [self.mColumeMaxWidths[i] floatValue],[self.mRowMaxHeights[0] floatValue])]; 485 | UILabel *dataView=[[UILabel alloc]initWithFrame:view.bounds]; 486 | dataView.text=data; 487 | dataView.textColor=RGB(94, 153, 251); 488 | dataView.textAlignment=NSTextAlignmentCenter; 489 | dataView.numberOfLines=0; 490 | dataView.font=self.textFont; 491 | [view addSubview:dataView]; 492 | view.layer.borderWidth=0.6; 493 | view.layer.borderColor=[UIColor whiteColor].CGColor; 494 | view.layer.backgroundColor=self.fristRowBackGround.CGColor; 495 | [cell.scrollView addSubview:view]; 496 | x+=view.frame.size.width; 497 | i++; 498 | } 499 | cell.scrollView.contentSize=CGSizeMake(x, cell.scrollView.frame.size.height); 500 | //加入滚动视图数组 501 | cell.scrollView.delegate=self; 502 | cell.scrollView.bounces=NO; 503 | cell.scrollView.contentOffset=self.mContentOffset; 504 | self.mHeadScrollView=cell.scrollView; 505 | [self.mScrollViewArray addObject:cell.scrollView]; 506 | return cell; 507 | } 508 | } 509 | return nil; 510 | } 511 | 512 | -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 513 | if (_isLockFristRow) { 514 | return [_mRowMaxHeights[0] floatValue]; 515 | } 516 | return 0; 517 | } 518 | 519 | #pragma mark UIScrollViewDelegate 520 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ 521 | // NSLog(@"scollView滚动实时位移:%f,%f", scrollView.contentOffset.x, scrollView.contentOffset.y); 522 | if (scrollView!=self.mTableView) { 523 | //过滤mTableView 524 | for (UIScrollView *view in _mScrollViewArray) { 525 | view.contentOffset=scrollView.contentOffset; 526 | } 527 | } 528 | } 529 | 530 | -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ 531 | // NSLog(@"scrollview内容视图宽度:%f",scrollView.contentSize.width); 532 | // NSLog(@"scollView滚动结束位移:%f,%f", scrollView.contentOffset.x, scrollView.contentOffset.y); 533 | // NSLog(@"scrollView显示的宽度:%f",self.frame.size.width-self.mLockViewWidth); 534 | if (scrollView!=self.mTableView) { 535 | //记录每次滚动结束之后的偏移量,防止列表重刷页面时偏移量复位 536 | self.mContentOffset=scrollView.contentOffset; 537 | 538 | if(scrollView.contentOffset.x==0){ 539 | // NSLog(@"滑动到最左侧!"); 540 | if (self.mLeftblock!=nil) { 541 | self.mLeftblock(scrollView.contentOffset); 542 | } 543 | } 544 | CGFloat scrollViewWidth=scrollView.contentSize.width; 545 | CGFloat scrollViewOffestX=scrollView.contentOffset.x; 546 | if (floor(scrollViewWidth-scrollViewOffestX)==floor(self.frame.size.width-self.mLockViewWidth)) { 547 | // NSLog(@"滑动到最右侧!"); 548 | if (self.mRightblock!=nil) { 549 | self.mRightblock(scrollView.contentOffset); 550 | } 551 | } 552 | } 553 | } 554 | 555 | 556 | 557 | 558 | @end 559 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/LockViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LockViewCell.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LockViewCell : UITableViewCell 12 | @property(nonatomic,retain) NSMutableArray *mRowMaxHeights;//记录每行最大高度,自适应高度 13 | @property (weak, nonatomic) IBOutlet UILabel *label; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/LockViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LockViewCell.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "LockViewCell.h" 10 | 11 | @implementation LockViewCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 19 | [super setSelected:selected animated:animated]; 20 | 21 | // Configure the view for the selected state 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/LockViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ScrollViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollViewCell.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ScrollViewCell : UITableViewCell 12 | @property(nonatomic,retain) NSMutableArray *mXTableDatas;//横向单行数据列表 13 | @property(nonatomic,retain) NSMutableArray *mColumeMaxWidths;//记录每列最大的宽度,自适应宽度 14 | @property(nonatomic,retain) NSMutableArray *mRowMaxHeights;//记录每行最大高度,自适应高度 15 | @end 16 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ScrollViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollViewCell.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/4/4. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ScrollViewCell.h" 10 | 11 | @implementation ScrollViewCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 19 | [super setSelected:selected animated:animated]; 20 | 21 | // Configure the view for the selected state 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/ScrollViewCell.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 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/UILabel+FitWitdhAndHeight.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+FitWitdhAndHeight.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/15. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (FitWitdhAndHeight) 12 | + (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont*)font; 13 | 14 | + (CGFloat)getWidthWithTitle:(NSString *)title font:(UIFont *)font; 15 | @end 16 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ExcelView/UILabel+FitWitdhAndHeight.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+FitWitdhAndHeight.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/15. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "UILabel+FitWitdhAndHeight.h" 10 | 11 | @implementation UILabel (FitWitdhAndHeight) 12 | + (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont *)font 13 | { 14 | 15 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 0)]; 16 | label.text = title; 17 | label.font = font; 18 | label.numberOfLines = 0; 19 | [label sizeToFit]; 20 | CGFloat height = label.frame.size.height; 21 | return height; 22 | } 23 | 24 | + (CGFloat)getWidthWithTitle:(NSString *)title font:(UIFont *)font { 25 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 1000, 0)]; 26 | label.text = title; 27 | label.font = font; 28 | [label sizeToFit]; 29 | return label.frame.size.width; 30 | } 31 | @end 32 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ExcelView 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.1.0 21 | CFBundleVersion 22 | 1.1.0 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | #import "ExcelView.h" 15 | #import "ViewController.h" 16 | 17 | //当前设备屏幕高度 18 | #define UIScreenHeight ([[UIScreen mainScreen] bounds].size.height) 19 | #define UIScreenWidth ([[UIScreen mainScreen] bounds].size.width) 20 | #define RGB(a, b, c) [UIColor colorWithRed:(a / 255.0f) green:(b / 255.0f) blue:(c / 255.0f) alpha:1.0f] 21 | #define RGBA(a, b, c, d) [UIColor colorWithRed:(a / 255.0f) green:(b / 255.0f) blue:(c / 255.0f) alpha:d] 22 | #endif /* PrefixHeader_pch */ 23 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | @property (weak, nonatomic) IBOutlet ExcelView *mExcelView; 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | @property(nonatomic,retain) NSMutableArray *leftTableDataArray;//表格第一列数据 13 | @property(nonatomic,retain) NSMutableArray *excelDataArray;//表格数据 14 | @property(nonatomic,retain) NSMutableArray *rightTableHeadArray;//表格第一行表头数据 15 | @property(nonatomic,retain) NSMutableArray *allTableDataArray;//表格所有数据 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | self.leftTableDataArray=(NSMutableArray *)@[@"塔城",@"哈密",@"和田",@"阿勒泰",@"克州"]; 23 | self.rightTableHeadArray=(NSMutableArray *)@[@"当日收入(万)",@"同比",@"环比",@"当月收入(万)",@"同比",@"环比",@"当年收入(万)",@"同比",@"环比"]; 24 | self.excelDataArray=(NSMutableArray *)@[@[@"2.91111111111111111",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%11111111111111111111",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"]]; 25 | 26 | 27 | // self.allTableDataArray=(NSMutableArray *)@[@[@"地区",@"当日收入(万)",@"同比",@"环比",@"当月收入(万)",@"同比",@"环比",@"当年收入(万)",@"同比",@"环比"],@[@"塔城",@"2.91111111111111111111111111111111111111111111111111111111",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"哈密",@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"和田",@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"阿勒泰",@"2.9",@"2%",@"3%",@"3.0",@"4%11111111111111111111",@"5%",@"18",@"4.5%",@"6.8%"],@[@"克州",@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"]]; 28 | 29 | self.allTableDataArray=[NSMutableArray arrayWithCapacity:10]; 30 | NSMutableArray *fristDatas=[NSMutableArray arrayWithCapacity:10]; 31 | [fristDatas addObject:@"标题"]; 32 | for (int i=0; i<22; i++) { 33 | [fristDatas addObject:[NSString stringWithFormat:@"标题%d",i]]; 34 | } 35 | [self.allTableDataArray addObject:fristDatas]; 36 | for (int i=0; i<22; i++) { 37 | NSMutableArray *rowDatas=[NSMutableArray arrayWithCapacity:10]; 38 | [rowDatas addObject:[NSString stringWithFormat:@"标题%d",i]]; 39 | for (int j=0; j<22;j++) { 40 | [rowDatas addObject:[NSString stringWithFormat:@"数据%d",j]]; 41 | } 42 | [self.allTableDataArray addObject:rowDatas]; 43 | } 44 | 45 | // NSLog(@"%@",self.allTableDataArray); 46 | 47 | // //代码方式添加 48 | // ExcelView *excelView=[[ExcelView alloc]initWithFrame:CGRectMake(0, 64, UIScreenWidth, UIScreenHeight)]; 49 | // excelView.topTableHeadDatas=self.rightTableHeadArray; 50 | // excelView.leftTabHeadDatas=self.leftTableDataArray; 51 | // excelView.tableDatas=self.excelDataArray; 52 | // excelView.isLockFristColumn=NO; 53 | // excelView.isLockFristRow=YES; 54 | // excelView.isColumnTitlte=YES; 55 | // excelView.columnTitlte=@"地区"; 56 | // [excelView show]; 57 | // [self.view addSubview:excelView]; 58 | 59 | 60 | //xib布局添加方式 61 | self.mExcelView.allTableDatas=self.allTableDataArray; 62 | self.mExcelView.isLockFristColumn=YES; 63 | self.mExcelView.isLockFristRow=YES; 64 | self.mExcelView.isColumnTitlte=YES; 65 | self.mExcelView.columnTitlte=@"地区"; 66 | self.mExcelView.columnMaxWidth=200; 67 | self.mExcelView.columnMinWidth=100; 68 | [self.mExcelView showWithLeftBlock:^(CGPoint contentOffset) { 69 | NSLog(@"滚动到了最左侧!"); 70 | NSLog(@"偏移量:%f",contentOffset.x); 71 | } AndWithRigthBlock:^(CGPoint contentOffset) { 72 | NSLog(@"滚动到了最右侧!"); 73 | NSLog(@"偏移量:%f",contentOffset.x); 74 | }]; 75 | 76 | // Do any additional setup after loading the view, typically from a nib. 77 | } 78 | 79 | 80 | - (void)didReceiveMemoryWarning { 81 | [super didReceiveMemoryWarning]; 82 | // Dispose of any resources that can be recreated. 83 | } 84 | 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/ViewController.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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /ExcelViewDemo/ExcelViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ExcelViewDemo 4 | // 5 | // Created by 郭翰林 on 2017/2/10. 6 | // Copyright © 2017年 郭翰林. 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 | -------------------------------------------------------------------------------- /GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RmondJone/ExcelView/54137e3a6225612c0067044fbe19cad5da9bca3f/GIF.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ExcelView 2 | IOS表格自定义视图,支持XIB布局,支持代码布局,支持锁双向表头。
3 | 4 | ## 效果展示 5 | 6 | ![image](https://github.com/RmondJone/ExcelView/blob/master/GIF.gif) 7 | 8 | ## 更新日志 9 | 10 | * 更新时间2017年02月11日09:48:27 -----ExcelView V1.0.0 11 | 12 | * 更新时间2017年02月17日11:17:14 -----ExcelView V1.0.1 13 | 14 | 添加表格宽度自适应,添加自定义第一行背景色属性和设置表格字体属性 15 | 16 | * 更新时间2017年02月27日15:58:07 -----ExcelView V1.0.2 17 | 18 | 添加表格高度自适应,添加设置单元格最大列宽 19 | 20 | * 更新时间2017年02月28日20:23:50 -----ExcelView V1.0.3 21 | 22 | 添加表格数据添加形式,原有数据添加形式保留,以每行数据为基本单元构造二维数组 23 | 24 | * 更新时间2017年03月17日15:22:02 -----ExcelView V1.0.4 25 | 26 | 部分BUG修改,新增最小列宽属性 27 | 28 | * 更新时间2017年03月18日12:17:40 -----ExcelView V1.0.5 29 | 30 | 新增滚动视图监听Block,滑动到最左侧或者最右侧自定义处理事件,防止有部分滚动视图嵌套表格的需求 31 | 32 | * 更新时间2017年04月05日11:20:31 -----ExcelView V1.0.6 33 | 34 | 版本重大BUG修改,数据过多时会引起异常奔溃 35 | 36 | 滚动时滚动视图数组不断增大从而引起遍历时间过长滚动缓慢问题(已重新设计方案) 37 | 38 | 列表先左移再上移会错行问题。 39 | 40 | * 更新时间2017年04月05日15:51:24 -----ExcelView V1.0.7 41 | 42 | 表格BUG修改,Cell复用问题导致的表格刷新,表头和表内容视图错列问题。 43 | 44 | Cell值初始化未清空导致的表格刷新滚动视图contentSize不对的问题。 45 | 46 | * 更新时间2017年04月10日18:01:46 -----ExcelView V1.0.8 47 | 48 | 表格BUG修改,Iphone6 Plus手机表格内容视图没有适配的BUG修改 49 | 50 | * 更新时间2017年07月11日13:07:59 -----ExcelView V1.0.9 51 | 52 | 表格BUG修改,当表格滑动到最右侧时偶尔不触发监听事件修改 53 | 54 | * 更新时间2017年08月31日17:21:55 -----ExcelView V1.1.0 55 | 56 | 表格BUG修改,横屏时不能填充整个屏幕修改 57 | 58 | ## API使用说明 59 | 60 | ```objective-c 61 | self.leftTableDataArray=(NSMutableArray *)@[@"塔城",@"哈密",@"和田",@"阿勒泰",@"克州"]; 62 | self.rightTableHeadArray=(NSMutableArray *)@[@"当日收入(万)",@"同比",@"环比",@"当月收入(万)",@"同比",@"环比",@"当年收入(万)",@"同比",@"环比"]; 63 | self.excelDataArray=(NSMutableArray *)@[@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"],@[@"2.9",@"2%",@"3%",@"3.0",@"4%",@"5%",@"18",@"4.5%",@"6.8%"]]; 64 | 65 | self.allTableDataArray=[NSMutableArray arrayWithCapacity:10]; 66 | NSMutableArray *fristDatas=[NSMutableArray arrayWithCapacity:10]; 67 | [fristDatas addObject:@"标题"]; 68 | for (int i=0; i<22; i++) { 69 | [fristDatas addObject:[NSString stringWithFormat:@"标题%d",i]]; 70 | } 71 | [self.allTableDataArray addObject:fristDatas]; 72 | for (int i=0; i<99; i++) { 73 | NSMutableArray *rowDatas=[NSMutableArray arrayWithCapacity:10]; 74 | [rowDatas addObject:[NSString stringWithFormat:@"标题%d",i]]; 75 | for (int j=0; j<22;j++) { 76 | [rowDatas addObject:[NSString stringWithFormat:@"数据%d",j]]; 77 | } 78 | [self.allTableDataArray addObject:rowDatas]; 79 | } 80 | 81 | //代码方式添加 82 | ExcelView *excelView=[[ExcelView alloc]initWithFrame:CGRectMake(0, 280, UIScreenWidth, 270)]; 83 | excelView.topTableHeadDatas=self.rightTableHeadArray; 84 | excelView.leftTabHeadDatas=self.leftTableDataArray; 85 | excelView.tableDatas=self.excelDataArray; 86 | excelView.isLockFristColumn=YES; 87 | excelView.isLockFristRow=YES; 88 | excelView.isColumnTitlte=YES; 89 | excelView.columnTitlte=@"地区"; 90 | [excelView show]; 91 | [self.view addSubview:excelView]; 92 | 93 | 94 | //xib布局添加方式 95 | self.mExcelView.allTableDatas=self.allTableDataArray; 96 | self.mExcelView.isLockFristColumn=YES; 97 | self.mExcelView.isLockFristRow=YES; 98 | self.mExcelView.isColumnTitlte=YES; 99 | self.mExcelView.columnTitlte=@"地区"; 100 | self.mExcelView.columnMaxWidth=200; 101 | self.mExcelView.columnMinWidth=100; 102 | [self.mExcelView showWithLeftBlock:^(CGPoint contentOffset) { 103 | NSLog(@"滚动到了最左侧!"); 104 | NSLog(@"偏移量:%f",contentOffset.x); 105 | } AndWithRigthBlock:^(CGPoint contentOffset) { 106 | NSLog(@"滚动到了最右侧!"); 107 | NSLog(@"偏移量:%f",contentOffset.x); 108 | }]; 109 | 110 | 111 | ``` 112 | ## 目前支持可自定义属性 113 | 114 | ```objective-c 115 | /** 116 | 是否锁定第一列 117 | */ 118 | @property BOOL isLockFristColumn; 119 | /** 120 | 是否锁定第一行 121 | */ 122 | @property BOOL isLockFristRow; 123 | /** 124 | 是否存在第一列列标题 125 | */ 126 | @property BOOL isColumnTitlte; 127 | /** 128 | 列标题名称(表格左上角数据) 129 | */ 130 | @property(nonatomic,copy) NSString *columnTitlte; 131 | /** 132 | 第一行表头数据(不包括表格左上角数据,只接收字符串) 133 | */ 134 | @property(nonatomic,retain) NSMutableArray *topTableHeadDatas; 135 | /** 136 | 第一列表头数据(不包括表格左上角数据,只接收字符串) 137 | 138 | */ 139 | @property(nonatomic,retain) NSMutableArray *leftTabHeadDatas; 140 | /** 141 | 表格数据(2维数组,不包括第一列和第一行数据,只接收字符串,例:@[@[],@[],....]) 142 | */ 143 | @property(nonatomic,retain) NSMutableArray *tableDatas; 144 | 145 | /** 146 | 表格数据(2维数组,每一行为一个子单元,只接受字符串,例:@[@[],@[],....] 147 | 设置该属性之后,columnTitlte、topTableHeadDatas、leftTabHeadDatas、tableDatas将被重置。 148 | */ 149 | @property(nonatomic,retain) NSMutableArray *allTableDatas; 150 | 151 | /** 152 | 设置字体 153 | */ 154 | @property(nonatomic,retain) UIFont *textFont; 155 | 156 | /** 157 | 第一行背景颜色 158 | */ 159 | @property(nonatomic,retain) UIColor *fristRowBackGround; 160 | /** 161 | 列最大宽度 162 | */ 163 | @property(nonatomic) CGFloat columnMaxWidth; 164 | /** 165 | 列最小宽度 166 | */ 167 | @property(nonatomic) CGFloat columnMinWidth; 168 | /** 169 | 显示,必须调用该方法,视图才会展现 170 | */ 171 | -(void)show; 172 | /** 173 | 滚动视图滑动到最左侧的Block 174 | */ 175 | @property(nonatomic,copy) ScrollViewToLeftBlock mLeftblock; 176 | /** 177 | 滚动视图滑动到最右侧的Block 178 | */ 179 | @property(nonatomic,copy) ScrollViewToRightBlock mRightblock; 180 | /** 181 | 显示,并加入滚动视图监听回调 182 | 183 | @param leftblock 滚动视图滑动到最左侧的Block 184 | @param rightblock 滚动视图滑动到最右侧的Block 185 | */ 186 | -(void)showWithLeftBlock:(ScrollViewToLeftBlock)leftblock AndWithRigthBlock:(ScrollViewToRightBlock) rightblock; 187 | 188 | 189 | ``` 190 | ## 使用说明 191 | * 直接复制项目根目录里ExcelView文件夹到你的项目中 192 | * 在需要用的地方引入 #import "ExcelView.h" 头文件,或者直接在PCH文件中引入 193 | 194 | ## 问题反馈 195 | * 联系方式:QQ(2318560278) 196 | * 技术交流群:QQ(264587303) 197 | * Demo作者:郭翰林 198 | --------------------------------------------------------------------------------