Closed confile closed 9 years ago
- (void)tapGestureAction:(UITapGestureRecognizer *)tapGesture {
CGRect topFrame = self.topView.frame;
topFrame.origin.y = topFrame.origin.y == 0 ? -(CGRectGetHeight(self.topView.bounds)-20-44) : 0;
CGRect collectionFrame = self.collectionView.frame;
collectionFrame.origin.y = CGRectGetMaxY(topFrame);
collectionFrame.size.height = CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(topFrame);
[UIView animateWithDuration:.3f animations:^{
self.topView.frame = topFrame;
self.collectionView.frame = collectionFrame;
} completion:^(BOOL finished) {
NSArray *selectedItems = [self.collectionView indexPathsForSelectedItems];
if ([selectedItems count]) {
NSIndexPath *ip = [selectedItems lastObject];
[self.collectionView scrollToItemAtIndexPath:ip atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
}
}];
}
Works great thank you.
When I scroll down the list of available photos in my gallery the the thumbnails take most of the screen. When I select one of them the topView becomes visible which shows the selected photo. The thumbnail view has now only two visible rows of thumbnails. But, the two visible rows do not show the selected thumbnail if this was not in the first two rows of the full screen thumbnail screen.
Is there an easy way to fix this?