Skip to content

Commit

Permalink
Changes implementation of stickyHeaders
Browse files Browse the repository at this point in the history
Changes where provided by @kishikawakatsumi
  • Loading branch information
leoMehlig committed Jul 17, 2017
1 parent 1deabea commit cc87670
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 0 additions & 11 deletions Framework/Sources/SpreadsheetView+Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ extension SpreadsheetView {
layoutRowHeader()
layoutColumnHeader()

if self.stickyRowHeader {
self.rowHeaderView.frame.origin.y = min(self.rootView.contentOffset.y, 0)
self.rowHeaderView.contentOffset.x = self.tableView.contentOffset.x
self.cornerView.frame.origin.y = min(self.rootView.contentOffset.y, 0)
}
if self.stickyColumnHeader {
self.columnHeaderView.frame.origin.x = min(self.rootView.contentOffset.x, 0)
self.columnHeaderView.contentOffset.y = self.tableView.contentOffset.y
self.cornerView.frame.origin.x = min(self.rootView.contentOffset.x, 0)
}

if needsReload {
adjustScrollViewFrames()

Expand Down
4 changes: 2 additions & 2 deletions Framework/Sources/SpreadsheetView+UIScrollViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ extension SpreadsheetView: UIScrollViewDelegate {
tableView.delegate = self
}

if tableView.contentOffset.x < 0 {
if tableView.contentOffset.x < 0 && !stickyColumnHeader {
let offset = tableView.contentOffset.x * -1
cornerView.frame.origin.x = offset
columnHeaderView.frame.origin.x = offset
} else {
cornerView.frame.origin.x = 0
columnHeaderView.frame.origin.x = 0
}
if tableView.contentOffset.y < 0 {
if tableView.contentOffset.y < 0 && !stickyRowHeader {
let offset = tableView.contentOffset.y * -1
cornerView.frame.origin.y = offset
rowHeaderView.frame.origin.y = offset
Expand Down

0 comments on commit cc87670

Please sign in to comment.