Skip to content

Commit

Permalink
Merge pull request #93 from leoMehlig/master
Browse files Browse the repository at this point in the history
Adds stickyHeader options
  • Loading branch information
kishikawakatsumi authored Jul 23, 2017
2 parents 85216a3 + cc87670 commit 2c8dff6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
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
14 changes: 14 additions & 0 deletions Framework/Sources/SpreadsheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ public class SpreadsheetView: UIView {
tableView.alwaysBounceHorizontal = newValue
}
}

/// A Boolean value that determines wheather the row header always sticks to the top.
/// - Note: `bounces` has to be `true` and there has to be at least one `frozenRow`.
/// The default value is `false`.
///
/// - SeeAlso: `stickyColumnHeader`
public var stickyRowHeader: Bool = false

/// A Boolean value that determines wheather the column header always sticks to the top.
/// - Note: `bounces` has to be `true` and there has to be at least one `frozenColumn`.
/// The default value is `false`.
///
/// - SeeAlso: `stickyRowHeader`
public var stickyColumnHeader: Bool = false

/// A Boolean value that determines whether paging is enabled for the scroll view.
/// - Note: If the value of this property is `true`, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls.
Expand Down

0 comments on commit 2c8dff6

Please sign in to comment.