From 20c198abe75ca6c613794dcdfdc9d279aaeb8cd4 Mon Sep 17 00:00:00 2001 From: Hao Song Date: Fri, 15 Apr 2016 11:28:08 -0700 Subject: [PATCH] Fix AssetsViewController not scrolling to bottom --- QBImagePicker/QBAssetsViewController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 37381715..3d4dddba 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -105,8 +105,10 @@ - (void)viewWillAppear:(BOOL)animated // Scroll to bottom if (self.fetchResult.count > 0 && self.isMovingToParentViewController && !self.disableScrollToBottom) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:(self.fetchResult.count - 1) inSection:0]; - [self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:(self.fetchResult.count - 1) inSection:0]; + [self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; + }); } }