Elastic rubber band effect for iPhone?

I have a UITableView in a UIView that has a rubber rope PNG attached to the top of the table. It remains on top, although when the table slides down, it is not part of the table, but only part of the view.

Desired behavior:

  • when the user pulls the table down, I would like to somehow pull this rope like a realistic rubber band

  • when they release the table, the table cells expand at the same speed as the attached gum.

This is not for scrolling in the form of a table, but when you say only 2 or 3 cells, and you pull it out and it stretches the rope, and when you release it, it comes back.

This is the same behavior as the default table view, but now there is only a rope attached to the top.

I am not looking for any specific answers, since I know that it can be difficult, but if you have any ideas in which direction I should go in order to accomplish this, please share.

+5
source share
1 answer

I came up with two different ideas:

Using images as transitions and stretch marks

My first idea is to create a bunch of images for each transition. Of course, not all the animation, only 5 different states for the rubber band, something like this:

The gray dots represent the points from it would be stretched

Each transition then goes to the next, stretching the image, and then switches to the next state until the last is reached. It would not look completely realistic, but convincing enough and enough to attract the attention of the user.

CGPathAddEllipseInRect

, , CALayer, - CGPathAddEllipseInRect ( ) . , .

+3

All Articles