UITableViewController buttons stick to top during pull to refresh

情到浓时终转凉″ 提交于 2019-12-12 00:56:37

问题


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.



来源:https://stackoverflow.com/questions/16234354/uitableviewcontroller-buttons-stick-to-top-during-pull-to-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!