Skip to content

Commit

Permalink
fixed section header & footer height
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuchetics committed Nov 7, 2017
1 parent 25fd228 commit febd08d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 0 additions & 6 deletions DataSource.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
Expand All @@ -695,7 +694,6 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
Expand All @@ -721,7 +719,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -750,7 +747,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -775,7 +771,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.buchetics.DataSourceTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand All @@ -798,7 +793,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.buchetics.DataSourceTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand Down
14 changes: 12 additions & 2 deletions DataSource/DataSource+UITableViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ extension DataSource: UITableViewDelegate {
return UITableViewAutomaticDimension
case .view(let view):
let height = view.bounds.height
return height == 0 ? UITableViewAutomaticDimension : height

if height == 0 {
return tableView.sectionHeaderHeight > 0 ? tableView.sectionHeaderHeight : UITableViewAutomaticDimension
} else {
return height
}
default:
return 0.0
}
Expand Down Expand Up @@ -230,7 +235,12 @@ extension DataSource: UITableViewDelegate {
return UITableViewAutomaticDimension
case .view(let view):
let height = view.bounds.height
return height == 0 ? UITableViewAutomaticDimension : height

if height == 0 {
return tableView.sectionFooterHeight > 0 ? tableView.sectionFooterHeight : UITableViewAutomaticDimension
} else {
return height
}
default:
return 0.0
}
Expand Down
6 changes: 6 additions & 0 deletions Example/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "[email protected]",
"scale" : "1x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LazyRowsViewController: UITableViewController {
super.viewDidLoad()

tableView.estimatedRowHeight = 44.0
tableView.sectionHeaderHeight = 40.0
tableView.sectionHeaderHeight = 60.0

tableView.dataSource = dataSource
tableView.delegate = dataSource
Expand Down

0 comments on commit febd08d

Please sign in to comment.