├── DynamicSectionHeaderHeight.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── emiliol.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── emiliol.xcuserdatad │ └── xcschemes │ ├── DynamicSectionHeaderHeight.xcscheme │ └── xcschememanagement.plist ├── DynamicSectionHeaderHeight ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SampleCell.h ├── SampleCell.m ├── SampleCell.xib ├── SampleHeader.h ├── SampleHeader.m ├── SampleHeader.xib ├── TableViewController.h ├── TableViewController.m └── main.m └── README.md /DynamicSectionHeaderHeight.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7EA293471BBABE8D00E1C554 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EA293461BBABE8D00E1C554 /* main.m */; }; 11 | 7EA2934A1BBABE8D00E1C554 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EA293491BBABE8D00E1C554 /* AppDelegate.m */; }; 12 | 7EA293501BBABE8D00E1C554 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EA2934E1BBABE8D00E1C554 /* Main.storyboard */; }; 13 | 7EA293521BBABE8D00E1C554 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7EA293511BBABE8D00E1C554 /* Assets.xcassets */; }; 14 | 7EA293551BBABE8D00E1C554 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EA293531BBABE8D00E1C554 /* LaunchScreen.storyboard */; }; 15 | 7EA2935E1BBABECF00E1C554 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EA2935D1BBABECF00E1C554 /* TableViewController.m */; settings = {ASSET_TAGS = (); }; }; 16 | 7EA293621BBABFD300E1C554 /* SampleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EA293601BBABFD300E1C554 /* SampleCell.m */; settings = {ASSET_TAGS = (); }; }; 17 | 7EA293631BBABFD300E1C554 /* SampleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7EA293611BBABFD300E1C554 /* SampleCell.xib */; settings = {ASSET_TAGS = (); }; }; 18 | 7EA293671BBAC02C00E1C554 /* SampleHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 7EA293661BBAC02C00E1C554 /* SampleHeader.m */; settings = {ASSET_TAGS = (); }; }; 19 | 7EA293691BBAC66400E1C554 /* SampleHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7EA293681BBAC66400E1C554 /* SampleHeader.xib */; settings = {ASSET_TAGS = (); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 7EA293421BBABE8D00E1C554 /* DynamicSectionHeaderHeight.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DynamicSectionHeaderHeight.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 7EA293461BBABE8D00E1C554 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | 7EA293481BBABE8D00E1C554 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 7EA293491BBABE8D00E1C554 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 7EA2934F1BBABE8D00E1C554 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 7EA293511BBABE8D00E1C554 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 7EA293541BBABE8D00E1C554 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 7EA293561BBABE8D00E1C554 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 7EA2935C1BBABECF00E1C554 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; 32 | 7EA2935D1BBABECF00E1C554 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; 33 | 7EA2935F1BBABFD300E1C554 /* SampleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleCell.h; sourceTree = ""; }; 34 | 7EA293601BBABFD300E1C554 /* SampleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleCell.m; sourceTree = ""; }; 35 | 7EA293611BBABFD300E1C554 /* SampleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SampleCell.xib; sourceTree = ""; }; 36 | 7EA293651BBAC02C00E1C554 /* SampleHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleHeader.h; sourceTree = ""; }; 37 | 7EA293661BBAC02C00E1C554 /* SampleHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleHeader.m; sourceTree = ""; }; 38 | 7EA293681BBAC66400E1C554 /* SampleHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SampleHeader.xib; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | 7EA2933F1BBABE8D00E1C554 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 7EA293391BBABE8D00E1C554 = { 53 | isa = PBXGroup; 54 | children = ( 55 | 7EA293441BBABE8D00E1C554 /* DynamicSectionHeaderHeight */, 56 | 7EA293431BBABE8D00E1C554 /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | 7EA293431BBABE8D00E1C554 /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 7EA293421BBABE8D00E1C554 /* DynamicSectionHeaderHeight.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | 7EA293441BBABE8D00E1C554 /* DynamicSectionHeaderHeight */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 7EA293481BBABE8D00E1C554 /* AppDelegate.h */, 72 | 7EA293491BBABE8D00E1C554 /* AppDelegate.m */, 73 | 7EA2935C1BBABECF00E1C554 /* TableViewController.h */, 74 | 7EA2935D1BBABECF00E1C554 /* TableViewController.m */, 75 | 7EA2934E1BBABE8D00E1C554 /* Main.storyboard */, 76 | 7EA293511BBABE8D00E1C554 /* Assets.xcassets */, 77 | 7EA293531BBABE8D00E1C554 /* LaunchScreen.storyboard */, 78 | 7EA293561BBABE8D00E1C554 /* Info.plist */, 79 | 7EA293451BBABE8D00E1C554 /* Supporting Files */, 80 | 7EA293641BBABFD700E1C554 /* SampleCell */, 81 | ); 82 | path = DynamicSectionHeaderHeight; 83 | sourceTree = ""; 84 | }; 85 | 7EA293451BBABE8D00E1C554 /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 7EA293461BBABE8D00E1C554 /* main.m */, 89 | ); 90 | name = "Supporting Files"; 91 | sourceTree = ""; 92 | }; 93 | 7EA293641BBABFD700E1C554 /* SampleCell */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 7EA2935F1BBABFD300E1C554 /* SampleCell.h */, 97 | 7EA293601BBABFD300E1C554 /* SampleCell.m */, 98 | 7EA293611BBABFD300E1C554 /* SampleCell.xib */, 99 | 7EA293651BBAC02C00E1C554 /* SampleHeader.h */, 100 | 7EA293661BBAC02C00E1C554 /* SampleHeader.m */, 101 | 7EA293681BBAC66400E1C554 /* SampleHeader.xib */, 102 | ); 103 | name = SampleCell; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 7EA293411BBABE8D00E1C554 /* DynamicSectionHeaderHeight */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 7EA293591BBABE8D00E1C554 /* Build configuration list for PBXNativeTarget "DynamicSectionHeaderHeight" */; 112 | buildPhases = ( 113 | 7EA2933E1BBABE8D00E1C554 /* Sources */, 114 | 7EA2933F1BBABE8D00E1C554 /* Frameworks */, 115 | 7EA293401BBABE8D00E1C554 /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = DynamicSectionHeaderHeight; 122 | productName = DynamicSectionHeaderHeight; 123 | productReference = 7EA293421BBABE8D00E1C554 /* DynamicSectionHeaderHeight.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 7EA2933A1BBABE8D00E1C554 /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastUpgradeCheck = 0700; 133 | ORGANIZATIONNAME = Sample; 134 | TargetAttributes = { 135 | 7EA293411BBABE8D00E1C554 = { 136 | CreatedOnToolsVersion = 7.0; 137 | }; 138 | }; 139 | }; 140 | buildConfigurationList = 7EA2933D1BBABE8D00E1C554 /* Build configuration list for PBXProject "DynamicSectionHeaderHeight" */; 141 | compatibilityVersion = "Xcode 3.2"; 142 | developmentRegion = English; 143 | hasScannedForEncodings = 0; 144 | knownRegions = ( 145 | en, 146 | Base, 147 | ); 148 | mainGroup = 7EA293391BBABE8D00E1C554; 149 | productRefGroup = 7EA293431BBABE8D00E1C554 /* Products */; 150 | projectDirPath = ""; 151 | projectRoot = ""; 152 | targets = ( 153 | 7EA293411BBABE8D00E1C554 /* DynamicSectionHeaderHeight */, 154 | ); 155 | }; 156 | /* End PBXProject section */ 157 | 158 | /* Begin PBXResourcesBuildPhase section */ 159 | 7EA293401BBABE8D00E1C554 /* Resources */ = { 160 | isa = PBXResourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | 7EA293551BBABE8D00E1C554 /* LaunchScreen.storyboard in Resources */, 164 | 7EA293631BBABFD300E1C554 /* SampleCell.xib in Resources */, 165 | 7EA293691BBAC66400E1C554 /* SampleHeader.xib in Resources */, 166 | 7EA293521BBABE8D00E1C554 /* Assets.xcassets in Resources */, 167 | 7EA293501BBABE8D00E1C554 /* Main.storyboard in Resources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXResourcesBuildPhase section */ 172 | 173 | /* Begin PBXSourcesBuildPhase section */ 174 | 7EA2933E1BBABE8D00E1C554 /* Sources */ = { 175 | isa = PBXSourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 7EA293671BBAC02C00E1C554 /* SampleHeader.m in Sources */, 179 | 7EA2934A1BBABE8D00E1C554 /* AppDelegate.m in Sources */, 180 | 7EA293621BBABFD300E1C554 /* SampleCell.m in Sources */, 181 | 7EA293471BBABE8D00E1C554 /* main.m in Sources */, 182 | 7EA2935E1BBABECF00E1C554 /* TableViewController.m in Sources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXSourcesBuildPhase section */ 187 | 188 | /* Begin PBXVariantGroup section */ 189 | 7EA2934E1BBABE8D00E1C554 /* Main.storyboard */ = { 190 | isa = PBXVariantGroup; 191 | children = ( 192 | 7EA2934F1BBABE8D00E1C554 /* Base */, 193 | ); 194 | name = Main.storyboard; 195 | sourceTree = ""; 196 | }; 197 | 7EA293531BBABE8D00E1C554 /* LaunchScreen.storyboard */ = { 198 | isa = PBXVariantGroup; 199 | children = ( 200 | 7EA293541BBABE8D00E1C554 /* Base */, 201 | ); 202 | name = LaunchScreen.storyboard; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXVariantGroup section */ 206 | 207 | /* Begin XCBuildConfiguration section */ 208 | 7EA293571BBABE8D00E1C554 /* Debug */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = NO; 212 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 213 | CLANG_CXX_LIBRARY = "libc++"; 214 | CLANG_ENABLE_MODULES = YES; 215 | CLANG_ENABLE_OBJC_ARC = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN_ENUM_CONVERSION = YES; 221 | CLANG_WARN_INT_CONVERSION = YES; 222 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 223 | CLANG_WARN_UNREACHABLE_CODE = YES; 224 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 225 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 226 | COPY_PHASE_STRIP = NO; 227 | DEBUG_INFORMATION_FORMAT = dwarf; 228 | ENABLE_STRICT_OBJC_MSGSEND = YES; 229 | ENABLE_TESTABILITY = YES; 230 | GCC_C_LANGUAGE_STANDARD = gnu99; 231 | GCC_DYNAMIC_NO_PIC = NO; 232 | GCC_NO_COMMON_BLOCKS = YES; 233 | GCC_OPTIMIZATION_LEVEL = 0; 234 | GCC_PREPROCESSOR_DEFINITIONS = ( 235 | "DEBUG=1", 236 | "$(inherited)", 237 | ); 238 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 239 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 240 | GCC_WARN_UNDECLARED_SELECTOR = YES; 241 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 242 | GCC_WARN_UNUSED_FUNCTION = YES; 243 | GCC_WARN_UNUSED_VARIABLE = YES; 244 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 245 | MTL_ENABLE_DEBUG_INFO = YES; 246 | ONLY_ACTIVE_ARCH = YES; 247 | SDKROOT = iphoneos; 248 | TARGETED_DEVICE_FAMILY = "1,2"; 249 | }; 250 | name = Debug; 251 | }; 252 | 7EA293581BBABE8D00E1C554 /* Release */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_WARN_BOOL_CONVERSION = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INT_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_UNREACHABLE_CODE = YES; 268 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 269 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 272 | ENABLE_NS_ASSERTIONS = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 283 | MTL_ENABLE_DEBUG_INFO = NO; 284 | SDKROOT = iphoneos; 285 | TARGETED_DEVICE_FAMILY = "1,2"; 286 | VALIDATE_PRODUCT = YES; 287 | }; 288 | name = Release; 289 | }; 290 | 7EA2935A1BBABE8D00E1C554 /* Debug */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 294 | INFOPLIST_FILE = DynamicSectionHeaderHeight/Info.plist; 295 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 296 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 297 | PRODUCT_BUNDLE_IDENTIFIER = Sample.DynamicSectionHeaderHeight; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | }; 300 | name = Debug; 301 | }; 302 | 7EA2935B1BBABE8D00E1C554 /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | INFOPLIST_FILE = DynamicSectionHeaderHeight/Info.plist; 307 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 309 | PRODUCT_BUNDLE_IDENTIFIER = Sample.DynamicSectionHeaderHeight; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | }; 312 | name = Release; 313 | }; 314 | /* End XCBuildConfiguration section */ 315 | 316 | /* Begin XCConfigurationList section */ 317 | 7EA2933D1BBABE8D00E1C554 /* Build configuration list for PBXProject "DynamicSectionHeaderHeight" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | 7EA293571BBABE8D00E1C554 /* Debug */, 321 | 7EA293581BBABE8D00E1C554 /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | defaultConfigurationName = Release; 325 | }; 326 | 7EA293591BBABE8D00E1C554 /* Build configuration list for PBXNativeTarget "DynamicSectionHeaderHeight" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | 7EA2935A1BBABE8D00E1C554 /* Debug */, 330 | 7EA2935B1BBABE8D00E1C554 /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | }; 334 | /* End XCConfigurationList section */ 335 | }; 336 | rootObject = 7EA2933A1BBABE8D00E1C554 /* Project object */; 337 | } 338 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight.xcodeproj/project.xcworkspace/xcuserdata/emiliol.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ebetabox/DynamicCellSectionHeight/36b5dd1b3f1d7f7ff7b79d032069a8a02c2ed493/DynamicSectionHeaderHeight.xcodeproj/project.xcworkspace/xcuserdata/emiliol.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight.xcodeproj/xcuserdata/emiliol.xcuserdatad/xcschemes/DynamicSectionHeaderHeight.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 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight.xcodeproj/xcuserdata/emiliol.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DynamicSectionHeaderHeight.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 7EA293411BBABE8D00E1C554 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. 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 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 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 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SampleCell.h 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SampleCell : UITableViewCell 12 | @property (weak, nonatomic) IBOutlet UILabel *label; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SampleCell.m 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import "SampleCell.h" 10 | 11 | @implementation SampleCell 12 | 13 | - (void)awakeFromNib { 14 | // Initialization code 15 | } 16 | 17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 18 | [super setSelected:selected animated:animated]; 19 | 20 | // Configure the view for the selected state 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // SampleHeader.h 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SampleHeader : UITableViewHeaderFooterView 12 | @property (weak, nonatomic) IBOutlet UILabel *label; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // SampleHeader.m 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import "SampleHeader.h" 10 | 11 | @implementation SampleHeader 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 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/SampleHeader.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 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 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.h 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DynamicSectionHeaderHeight/TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.m 3 | // DynamicSectionHeaderHeight 4 | // 5 | // Created by Emilio on 29/09/15. 6 | // Copyright © 2015 Sample. All rights reserved. 7 | // 8 | 9 | #import "TableViewController.h" 10 | #import "SampleCell.h" 11 | #import "SampleHeader.h" 12 | 13 | @interface TableViewController () 14 | 15 | @end 16 | 17 | @implementation TableViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | [self.tableView registerNib:[UINib nibWithNibName:@"SampleCell" bundle:nil] forCellReuseIdentifier:@"SampleCell"]; 23 | [self.tableView registerNib:[UINib nibWithNibName:@"SampleHeader" bundle:nil] forHeaderFooterViewReuseIdentifier:@"SampleHeader"]; 24 | 25 | self.tableView.estimatedRowHeight = 20; 26 | self.tableView.rowHeight = UITableViewAutomaticDimension; 27 | 28 | self.tableView.sectionHeaderHeight = UITableViewAutomaticDimension; 29 | self.tableView.estimatedSectionHeaderHeight = 10; 30 | 31 | self.tableView.dataSource = self; 32 | } 33 | 34 | #pragma mark - Table view data source 35 | 36 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 37 | return 3; 38 | } 39 | 40 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 41 | return 2; 42 | } 43 | 44 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 45 | SampleCell *cell = (SampleCell *)[tableView dequeueReusableCellWithIdentifier:@"SampleCell" forIndexPath:indexPath]; 46 | 47 | // Configure the cell... 48 | cell.label.text = [self randomLenghtString]; 49 | 50 | return cell; 51 | } 52 | 53 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ 54 | SampleHeader *header = (SampleHeader * )[tableView dequeueReusableHeaderFooterViewWithIdentifier:@"SampleHeader"]; 55 | 56 | switch (section) { 57 | case 0: 58 | header.label.text = @"Section 1. It has a short title."; 59 | break; 60 | 61 | case 1: 62 | header.label.text = @"Section 2. It has a medium tilte, the view will grow to addapt"; 63 | break; 64 | 65 | case 2: 66 | header.label.text = @"Section 3. It has a extra large title, the view will grow to addapt follwoing the autolayout constraints that we have set in the interface builder"; 67 | break; 68 | 69 | default: 70 | header.label.text = @"Default header title"; 71 | break; 72 | } 73 | 74 | return header; 75 | } 76 | 77 | 78 | - (NSString *)randomLenghtString{ 79 | NSUInteger r = arc4random_uniform(5); 80 | 81 | NSString *baseString = @"Sample cell with variable amount of text to demostrate the dynamic height of for the cell."; 82 | 83 | NSMutableString *mutableText = [[NSMutableString alloc] initWithString:baseString]; 84 | 85 | for (int i=0; i 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DynamicCellSectionHeight 2 | Make use of UITableViewAutomaticDimension to determine the UITableViewCell and UITableHeaderFooterView dynamically based on autolayout constraints. 3 | 4 | This test project is based on this StackOverFlow question: 5 | http://stackoverflow.com/questions/29462331/is-it-possible-to-obtain-a-dynamic-table-view-section-header-height-using-auto-l 6 | 7 | It is a basic implementation that allows the cells and headers of the table to dynamically addapt to the size of the content. 8 | --------------------------------------------------------------------------------