Is there a way to disable automatic scrolling of the UICollectionView
when cell gets focused? I want to adjust the content offset of the cell manually when it gets into focus.
I wan't to update the content offset in:
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
[coordinator addCoordinatedAnimations:^
{
[UIView animateWithDuration:[UIView inheritedAnimationDuration]
animations:^
{
// Move next focused cell.
if ([context.nextFocusedView isKindOfClass:[YBZEventCollectionViewCell class]])
{
UICollectionViewCell *cell = (UICollectionViewCell *)context.nextFocusedView;
CGPoint offset = CGPointMake(CGRectGetMinX(cell.frame), 0.0f);
[_collectionView setContentOffset:offset];
}
}];
} completion:nil];
}
This works but since the focus engine also moves my cell (scrolls it) I end up with animation which is not smooth, there is a "kick" at the end of it.
collectionView.isScrollEnabled
in code – Rives