Search code examples
iosobjective-cuiscrollviewuiscrollviewdelegate

Cant find the Scroll View property to know how many pixels the scroll view did scroll


I have a scroll view with a label in it, and I wants after someones scroll the label X px's to the right and release his finger to delete this label with animation.

So I created a delegate connection and added the scroll view delegate method:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

    NSLog(@"scroll view did scroll");
}

In this method I want to say something like:

if myScrollView.someProperty moved X px's to the right and the user pulled his finger 

delete this label sliding with animation to the right

Can someone please help out here :/

tnx ahead!!


Solution

  • Check UIScrollView's contentOffset property:

    contentOffset - The point at which the origin of the content view is offset 
    from the origin of the scroll view.