Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
604 views
in Technique[技术] by (71.8m points)

iphone - UIRefreshControl in Landscape

I've got a UIRefreshControl at the top of my table.

The screen is in landscape.

The trouble is, I can't pull down far enough in order to trigger the refresh, because there is too little space in Landscape. Is there a way to adjust the amount you have to pull down?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remember that your tableview is just a subclass of UIScrollView. In your controller, implement scrollViewDidScroll method and call -beginRefreshing on your UIRefreshControl like below.

But the animation of the UIRefreshControl while going to refreshing state wont be as smooth as you would expect. But it works.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y < -98 && ![self.refresher isRefreshing]) {
        [self.refresher beginRefreshing];
        //do all the work
        [self.refresher endRefreshing];
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...