문제

I don't know what this effect is called. Fancy uses it in its app. It works like this.

  • You have an image at the top of a scrollview.
  • Drag down and the image gets zoomed to fill the extra top space, so its top edge always remains at the top edge of this scrollview
  • release your finger and it bounces back

Please give me some idea on how to build this effect. Thanks!

도움이 되었습니까?

해결책

There are many open source implementations of this, such as:

The basic idea behind these is to have an imageview as a subview of the scrollview. When scrolling, you monitor the content offset of the scrollview, and when you reach a certain threshold, you start increasing the image view's height. If you set the image view's contentMode to UIViewContentModeScaleAspectFill, you will get the effect you want.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top