【问题标题】:UIScrollView scrollViewWillEndDragging: targetContentOffset: not workingUIScrollView scrollViewWillEndDragging:targetContentOffset:不工作
【发布时间】:2014-03-12 23:08:49
【问题描述】:

为什么这不起作用?我在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];
        });
    }
}

【问题讨论】:

  • 输入条件了吗?委托方法是否被正确调用?
  • @0x7fffffff 是的,我在第三行设置了一个断点,并且正在到达它。只是在做targetContentOffset-&gt;y = -50.0f;没有效果

标签: ios objective-c uiscrollview uiscrollviewdelegate


【解决方案1】:

这似乎是你的答案。

scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView

当滚动视图处于其默认内容偏移时,设置 targetContentOffsettargetContentOffset 存在 UIScrollView 错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多