Ios UIScrollView ScrollViewWillendDraging:targetContentOffset:不工作

Ios UIScrollView ScrollViewWillendDraging:targetContentOffset:不工作,ios,objective-c,uiscrollview,uiscrollviewdelegate,Ios,Objective C,Uiscrollview,Uiscrollviewdelegate,为什么这不起作用?我在targetContentOffset->y=-50.0f设置了一个断点并且它正在被击中,不确定为什么它没有任何效果 是=否 - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { if (scrollView.conten

为什么这不起作用?我在
targetContentOffset->y=-50.0f设置了一个断点并且它正在被击中,不确定为什么它没有任何效果

是=否

- (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];
        });
    }
}
-(void)ScrollViewWillendDraging:(UIScrollView*)带速度的scrollView:(CGPoint)速度targetContentOffset:(inout CGPoint*)targetContentOffset{
如果(scrollView.contentOffset.y<-50.0f){
targetContentOffset->y=-50.0f;
}
否则{
*targetContentOffset=CGPointZero;
//需要随后调用此函数以消除闪烁。
dispatch\u async(dispatch\u get\u main\u queue()^{
[scrollView setContentOffset:CGPointZero动画:是];
});
}
}

这似乎是你的答案


当滚动视图处于默认内容偏移量时,设置
ScrollView的
targetContentOffset
会出现
UIScrollView的
bug错误。是否输入了条件?委托方法被正确调用了吗?@0x7fffffff是的,我在下面的第三行设置了一个断点,正在到达它。它只是执行
targetContentOffset->y=-50.0f无效