Skip to content

Commit

Permalink
Properly call UITableViewDelegate for headers and footers height. Closes
Browse files Browse the repository at this point in the history
 #44.
  • Loading branch information
DenTelezhkin committed Oct 13, 2016
1 parent ec810e7 commit 0a74b18
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [5.0.0-beta.3](https://github.com/DenHeadless/DTTableViewManager/releases/tag/5.0.0-beta.3)

* `DTModelStorage` dependency now requires `Realm 2.0`
* `UITableViewDelegate` `heightForHeaderInSection` and `heightForFooterInSection` are now properly called on the delegate, if it implements it(thanks, @augmentedworks!).

## [5.0.0-beta.2](https://github.com/DenHeadless/DTTableViewManager/releases/tag/5.0.0-beta.2)

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "DenHeadless/DTModelStorage" "3.0.0-beta.1"
github "DenHeadless/DTModelStorage" "3.0.0-beta.3"
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Quick/Nimble" "master"
github "Quick/Nimble" "v5.0.0"
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Nimble" "db706fc1d7130f6ac96c56aaf0e635fa3217fe57"
github "realm/realm-cocoa" "v1.1.0"
github "DenHeadless/DTModelStorage" "3.0.0-beta.1"
github "Quick/Nimble" "v5.0.0"
github "realm/realm-cocoa" "v2.0.2"
github "DenHeadless/DTModelStorage" "3.0.0-beta.3"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/DTModelStorage
2 changes: 1 addition & 1 deletion Carthage/Checkouts/realm-cocoa
4 changes: 2 additions & 2 deletions DTTableViewManager.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'DTTableViewManager'
s.version = '5.0.0-beta.2'
s.version = '5.0.0-beta.3'
s.license = 'MIT'
s.summary = 'Protocol-oriented UITableView management, powered by generics and associated types.'
s.homepage = 'https://github.com/DenHeadless/DTTableViewManager'
Expand All @@ -12,5 +12,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '9.0'
s.frameworks = 'UIKit', 'Foundation'
s.dependency 'DTModelStorage' , '~> 3.0.0-beta.2'
s.dependency 'DTModelStorage' , '~> 3.0.0-beta.3'
end
12 changes: 0 additions & 12 deletions DTTableViewManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
9A587D861CE335D80094C821 /* DTModelStorage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A587D541CE334E70094C821 /* DTModelStorage.framework */; };
9A587D871CE335DF0094C821 /* DTModelStorage.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A587D541CE334E70094C821 /* DTModelStorage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9A6CED701BE570750091B0AF /* DTTableViewManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A2A38BC1AEE285E0021E97D /* DTTableViewManager.framework */; };
9A892A6F1D997ACD0044A4A9 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A892A6E1D997ACD0044A4A9 /* Realm.framework */; };
9A892A711D997AD10044A4A9 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A892A701D997AD10044A4A9 /* RealmSwift.framework */; };
9A892A721D997ADD0044A4A9 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A892A701D997AD10044A4A9 /* RealmSwift.framework */; };
9A892A731D997ADD0044A4A9 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A892A701D997AD10044A4A9 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9A892A741D997ADD0044A4A9 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A892A6E1D997ACD0044A4A9 /* Realm.framework */; };
9A892A751D997ADD0044A4A9 /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A892A6E1D997ACD0044A4A9 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9A9B17071B65771600D8ABD3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A9B17061B65771600D8ABD3 /* AppDelegate.swift */; };
9A9B170E1B65771600D8ABD3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A9B170C1B65771600D8ABD3 /* Main.storyboard */; };
9A9B17101B65771600D8ABD3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A9B170F1B65771600D8ABD3 /* Images.xcassets */; };
Expand Down Expand Up @@ -262,10 +256,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9A892A751D997ADD0044A4A9 /* Realm.framework in CopyFiles */,
9A587D871CE335DF0094C821 /* DTModelStorage.framework in CopyFiles */,
9AA3E6C51BA84CB4004950AE /* DTTableViewManager.framework in CopyFiles */,
9A892A731D997ADD0044A4A9 /* RealmSwift.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -380,10 +372,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9A892A741D997ADD0044A4A9 /* Realm.framework in Frameworks */,
9A892A711D997AD10044A4A9 /* RealmSwift.framework in Frameworks */,
9A892A721D997ADD0044A4A9 /* RealmSwift.framework in Frameworks */,
9A892A6F1D997ACD0044A4A9 /* Realm.framework in Frameworks */,
9A587D861CE335D80094C821 /* DTModelStorage.framework in Frameworks */,
9A9B17261B65772E00D8ABD3 /* DTTableViewManager.framework in Frameworks */,
);
Expand Down
10 changes: 8 additions & 2 deletions Source/DTTableViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ extension DTTableViewManager: UITableViewDelegate
if let height = performHeaderReaction(.heightForHeaderInSection, location: section, provideView: false) as? CGFloat {
return height
}
if let height = (delegate as? UITableViewDelegate)?.tableView?(tableView, heightForHeaderInSection: section) {
return height
}
if configuration.sectionHeaderStyle == .title {
if let _ = self.headerModel(forSection:section)
{
Expand All @@ -908,7 +911,7 @@ extension DTTableViewManager: UITableViewDelegate
{
return self.tableView?.sectionHeaderHeight ?? CGFloat.leastNormalMagnitude
}
return (delegate as? UITableViewDelegate)?.tableView?(tableView, heightForHeaderInSection: section) ?? CGFloat.leastNormalMagnitude
return CGFloat.leastNormalMagnitude
}

open func tableView(_ tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -> CGFloat {
Expand All @@ -922,6 +925,9 @@ extension DTTableViewManager: UITableViewDelegate
if let height = performFooterReaction(.heightForFooterInSection, location: section, provideView: false) as? CGFloat {
return height
}
if let height = (delegate as? UITableViewDelegate)?.tableView?(tableView, heightForFooterInSection: section) {
return height
}
if configuration.sectionFooterStyle == .title {
if let _ = self.footerModelForSectionIndex(section) {
return UITableViewAutomaticDimension
Expand All @@ -932,7 +938,7 @@ extension DTTableViewManager: UITableViewDelegate
if let _ = self.footerModelForSectionIndex(section) {
return self.tableView?.sectionFooterHeight ?? CGFloat.leastNormalMagnitude
}
return (delegate as? UITableViewDelegate)?.tableView?(tableView, heightForFooterInSection: section) ?? CGFloat.leastNormalMagnitude
return CGFloat.leastNormalMagnitude
}

open func tableView(_ tableView: UITableView, estimatedHeightForFooterInSection section: Int) -> CGFloat {
Expand Down

0 comments on commit 0a74b18

Please sign in to comment.