UIRefreshControl bug in landscape mode.

The iOS UIRefreshControl provides a standard “pull-down-to-refresh” mechanism for certain UIScrollView classes such as UITableView and UICollectionView.

The UIRefreshControl, however, has a bug in landscape mode on the iPhone whereby there isn’t enough room to pull down to trigger the refresh mechanism. Go here for more information on the bug and possible workarounds.

I ended up using the following code in my UIScrollViewDelegate implementation (both UITableViewDelegate and UICollectionViewDelegate conform to UIScrollViewDelegate):

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    if (self.collectionView.contentOffset.y < -80 && ![self.pullDownRefreshControl isRefreshing])
    {
        [self.pullDownRefreshControl beginRefreshing];
        // perform refresh operation...
    }
}

The “pull-down-to-refresh” animation isn’t as slick, but it’s a good workaround for now.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s