@@ -20,7 +20,7 @@ @interface QBAssetsCollectionViewController ()
20
20
@property (nonatomic , assign ) NSUInteger numberOfPhotos;
21
21
@property (nonatomic , assign ) NSUInteger numberOfVideos;
22
22
23
- @property (nonatomic , assign ) BOOL disableScrollToBottom;
23
+ @property (nonatomic , assign ) BOOL disableScrollToBottom, appearToShow ;
24
24
25
25
@end
26
26
@@ -52,6 +52,7 @@ - (void)viewWillAppear:(BOOL)animated
52
52
if (self.allowsMultipleSelection ) {
53
53
self.navigationItem .rightBarButtonItem .enabled = [self validateNumberOfSelections: self .imagePickerController.selectedAssetURLs.count];
54
54
}
55
+ _appearToShow = YES ;
55
56
}
56
57
57
58
- (void )viewWillDisappear : (BOOL )animated
@@ -68,6 +69,14 @@ - (void)viewDidDisappear:(BOOL)animated
68
69
self.disableScrollToBottom = NO ;
69
70
}
70
71
72
+ - (void )viewDidLayoutSubviews {
73
+ [super viewDidLayoutSubviews ];
74
+ if (_appearToShow) {
75
+ [self .collectionView scrollToItemAtIndexPath: [NSIndexPath indexPathForRow: self .numberOfAssets-1 inSection: 0 ] atScrollPosition: UICollectionViewScrollPositionTop animated: NO ];
76
+ _appearToShow = NO ;
77
+ }
78
+ }
79
+
71
80
72
81
#pragma mark - Accessors
73
82
@@ -211,7 +220,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
211
220
QBAssetsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier: @" AssetsCell" forIndexPath: indexPath];
212
221
cell.showsOverlayViewWhenSelected = self.allowsMultipleSelection ;
213
222
214
- ALAsset *asset = self.assets [self .assets.count - 1 - indexPath.row];
223
+ ALAsset *asset = self.assets [indexPath.row];
215
224
cell.asset = asset;
216
225
217
226
return cell;
0 commit comments