Closed hrsalehi closed 7 years ago
When I add GSKStretchyHeaderView to a static table view, headers not stick to the top and they have gap with size of the maximum stretchy header to the top.
GSKStretchyHeaderView
headerView = Bundle.main.loadNibNamed("HeaderView", owner: self, options: nil)![0] as? UIView let hView = GSKStretchyHeaderView(frame: CGRect(x: 0 ,y:0 ,width: self.view.frame.size.width ,height:self.view.frame.size.width * 2 / 3)) hView.addSubview(headerView!) hView.minimumContentHeight = 64 hView.maximumContentHeight = 250 self.tableView.addSubview(hView)
and here is my sticky header
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { if section == 1 { self.viewHeaderPrice.backgroundColor = UIColor.red return self.viewHeaderPrice } return super.tableView(tableView, viewForHeaderInSection: section) } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if section == 1 { return self.viewHeaderPrice.height } return 0 }
You can see the red header (Section 1) remains in the middle of screen with scroll
I figured the problem out. I didn't set this value hView.manageScrollViewInsets = false
hView.manageScrollViewInsets = false
Cool, glad it works for you!
When I add
GSKStretchyHeaderView
to a static table view, headers not stick to the top and they have gap with size of the maximum stretchy header to the top.and here is my sticky header
You can see the red header (Section 1) remains in the middle of screen with scroll