简体   繁体   中英

Animate a View to a selected cell in collectionView or tableView in scrollView

I know the title is not explanatory, but the following image will explain what I want to achieve.

在此处输入图片说明

Is there any way that I can complete this task?

What you need to do is…

  • Find a common superview to both your view and cell
  • Calculate the start position in the superview
  • Calculate the end position in the superview relative to the cell
  • add the view to the superview at the start position
  • Animate to the end position
  • add the view to the cell, keeping it in position

You'll need to use

convert(_rect:, to view:) -> CGRect

to find A view 's start and end position in the common superview

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM