UIScrollView的scrollViewWillEndDragging:targetContentOffset:方法无法工作

3

为什么这个不起作用?我在targetContentOffset->y = -50.0f;处设置了断点,它被触发了,但不确定为什么没有任何效果。

是的,paging = NO。

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
    if (scrollView.contentOffset.y < -50.0f) {
        targetContentOffset->y = -50.0f;
    }
    else {
        *targetContentOffset = CGPointZero;

        // Need to call this subsequently to remove flickering.
        dispatch_async(dispatch_get_main_queue(), ^{
            [scrollView setContentOffset:CGPointZero animated:YES];
        });
    }
}

条件是否被输入?委托方法是否被正确调用? - Mick MacCallum
@0x7fffffff 是的,我在第三行设置了断点并已到达。只是执行targetContentOffset->y = -50.0f;没有效果。 - random
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接