diff --git a/Framework/Sources/SpreadsheetView+UIScrollViewDelegate.swift b/Framework/Sources/SpreadsheetView+UIScrollViewDelegate.swift index 4b4228c8..c86c57e1 100644 --- a/Framework/Sources/SpreadsheetView+UIScrollViewDelegate.swift +++ b/Framework/Sources/SpreadsheetView+UIScrollViewDelegate.swift @@ -19,7 +19,7 @@ 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 @@ -27,7 +27,7 @@ extension SpreadsheetView: UIScrollViewDelegate { 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 diff --git a/Framework/Sources/SpreadsheetView.swift b/Framework/Sources/SpreadsheetView.swift index a9b6f3c7..c9650ff1 100644 --- a/Framework/Sources/SpreadsheetView.swift +++ b/Framework/Sources/SpreadsheetView.swift @@ -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.