Scroll a background in a different speed on a UIScrollView

前端 未结 4 1141
青春惊慌失措
青春惊慌失措 2021-01-13 13:32

When somebody does a wipe gesture to scroll the content from left to right, I would like to have a background image scrolling into the same direction, but at a different spe

4条回答
  •  清歌不尽
    2021-01-13 13:53

    You can do it with CoreAnimation. You'll want to hook into the scrollViewDidEndDragging:willDecelerate: and scrollViewWillBeginDecelerating: UIScrollViewDelegate methods. Then begin an Animation on your image by changing the center position. See this SO article for more on animations.

提交回复
热议问题