Reputation: 5413
I have a mockup that looks like this:
This is all one big Table Controller that you can scroll.
When the section header hits the top of the page it freezes along the top, like so:
Which is working fine. However, when you go back to the top and do a pull to refresh, I want it to do this:
So the pull to refresh dialog appears between the top table header cell and the section header (that is no longer frozen).
Is this possible? I haven't found an implementation like this in my searches.
Upvotes: 4
Views: 1552
Reputation: 23278
You can do the following to achieve this,
UIScrollView
as the subview of UIViewController's
view.UIView
and UITableView
as the subview of this scroll viewUIView
inside scroll view represents table header cell.UITableview
and table contents represents the UITableView's
cells.UIRefreshControl
as subview of UITableView
and set its target method.- (void)scrollViewDidScroll:(UIScrollView *)scrollView
for both UITableview
and UIScrollview
. UIView
table cell header is visible after this stop scrolling of UIScrollview
and allow table view to scroll. This will enable the UIRefreshControl
. Here the key thing is the - (void)scrollViewDidScroll:(UIScrollView *)scrollView
method and how you implement the scrolling. You can add a check for contentOffset
to determine how much tableview and scrollview has been scrolled. In order to restrict the scrolling you can manually set this value in this delegate method to a particular value and it wont scroll after that.
Upvotes: 1