小编Jer*_*ong的帖子

UICollectionView交互式过渡抛出异常

我正在尝试在UICollectionView上实现收缩扩展,并且遇到了一些麻烦。与我可以找到的所有示例代码不同,我不是在交互式UINavigationController过渡的过程中执行此操作-我只需要就地扩展项。

这是我的捏手势识别器:

- (void)pinchGestureDidPinch:(UIPinchGestureRecognizer *)recognizer
{
    CGFloat targetScale = 3.0;
    CGFloat scale = recognizer.scale;
    if (recognizer.state == UIGestureRecognizerStateBegan) {
        CGPoint point = [recognizer locationInView:self.collectionView];
        NSIndexPath *rowUnder = [self.collectionView indexPathForItemAtPoint:point];
        self.pinchingRow = [NSIndexPath indexPathForItem:0 inSection:rowUnder.section];
        self.currentState = HACStreamViewControllerTransitioning;
        self.expandedLayout.expandedSection = self.pinchingRow.section;
        self.transitionLayout = [self.collectionView startInteractiveTransitionToCollectionViewLayout:self.expandedLayout completion:nil];
    } else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {
        if (scale >= targetScale) {
            [self.collectionView finishInteractiveTransition];
            self.currentState = HACStreamViewControllerExpanded;
        } else {
            [self.collectionView cancelInteractiveTransition];
            self.currentState = HACStreamViewControllerCollapsed;
        }
    } else {
        // change …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uicollectionview

5
推荐指数
1
解决办法
952
查看次数

标签 统计

ios ×1

objective-c ×1

uicollectionview ×1