How to simulate the movement of tables using CAMediaTimingFunction

I have a table view and another view, and I would like to animate another view so that it slows down and stops at the same time and an animation curve, as a tableview does when scrolling. So, I suppose that I can implement

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

and use velocity(pixels per millisecond) targetContentOffsetand the tableview property decelerationRateto calculate how long it will take to stop using the physical equation d= (vi+vf) / 2 * tto calculate the duration of my animation.As soon as I have this, I just need the animation to slow down at the same speed as and tableView so that they looked “synchronized”. How would I do this using a property CAMediaTimingFunctionand a tableview decelerationRate?

Thank!

+4
source share
3 answers

Try using UIAnimationand set the animation curve to UIViewAnimationCurveEaseOutusing

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve.

time = velocity / acceleration.

[UIScrollViewDelegate scrollViewDidScroll:], , , scrollview , .

0

, decelerationRate CAMediaTimingFunction. , UIScrollView ( UITableView ) , . , , , , UIScrollView, decelerationRate. , , ..

-, , , UIScrollView ( TableView) .

, UITableCell s UITableView, ? , . , .

scrollViewDidScroll:, viewOffset . , . , NSRunLoop, , , , .

WWDC 2012, " ", UIScrollView OpenGL.

0

scrollViewDidScroll: delegate . scrollViewWillEndDragging: scrollViewDidScroll:. , , .

scrollViewDidScroll: , . , .

0

Source: https://habr.com/ru/post/1539354/


All Articles