ios - How to have UIScrollView animate off screen when dragged -
so have uiviewcontroller
, have uiscrollview
inside of it, has ui elements.
i want user able drag uiscrollview
, down, when drags past threshold, want animate off screen. there needs springiness though. tried using -(void)scrollviewdidscroll:
couldn't seem right. thoughts?
in scroll view delegate method -(void)scrollviewdidscroll:(uiscrollview *)scrollview;
observe scrollview.contentoffset.y
, trigger animation when reaches expected y position.
for example:
cgfloat ytranslation = -200.f; // value want shift [uiview animatewithduration:0.35 animations:^{ scrollview.transform = cgaffinetransformmaketranslation(0, ytranslation); } completion:^(bool finished) { // code after completion }];
Comments
Post a Comment