Can I use UIRefreshControl with UICollectionViewScrollDirectionHorizontal?

Posted by Dan Abramov on Stack Overflow See other posts from Stack Overflow or by Dan Abramov
Published on 2012-12-10T23:01:31Z Indexed on 2012/12/10 23:03 UTC
Read the original article Hit count: 609

You can add UIRefreshControl to UICollectionView (or any UIScrollView for that matter) by adding it to collection's subviews:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];

This doesn't work when collection view layout has UICollectionViewScrollDirectionHorizontal.

I tried overriding layoutSubviews to put refresh control to the left, but it wouldn't track scrolling progress this way. Can I trick it into working with horizontal layouts?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios6