Expand UITableView Header View to Bounce Area When Pulling Down

前端 未结 4 536
孤独总比滥情好
孤独总比滥情好 2021-02-03 11:10

I have implemented a MKMapView in the header area and I\'d like to expand it fully to the top even when you drag down the table into the bounce area - Similar to Fours

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 11:21

    I put the content of the header view inside another view which I constrain to each side of the header view. Then using an IBOutlet to the top constraint I just set it to the contentOffset.

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        if (_tableView.contentOffset.y < 0) {
            _mapTopConstraint.constant = _tableView.contentOffset.y;
        }
    }
    

提交回复
热议问题