UITableViewController buttons stick to top during

2019-09-03 18:15发布

问题:

I am trying to figure out how to have a UITableView with a view at the top which scrolls with the table, but when you pull to refresh, the view stays at the top of the screen and the refresh control is below. This is just like the Facebook App with their Status, Photo and Check In buttons.

I can't work out how to do it, any ideas ?

回答1:

In Facebook the header isn't part of the table view, it's just a view positioned above the table view. The table view is a subclass of UIScrollView so you will receive scroll view delegate methods. You can use these to monitor the scroll view content offset and then change the frames of the header and table views to get the effect you want.



回答2:

The elements which you add to the UIScrollView will scroll along with it. The scroll view is added to the UIView. Now if you add additional components to the UIView they wont scroll.