简体   繁体   中英

(iOS) How can i animate the traslation of UI elements, like labels and images in the transition between two viewcontrollers?

I'm working on animated transitions between VC. I have a collectionVC and a DetailVC. The collectionVC has custom type cells and there are some common UI items like labels and images between both VC. The idea is that when a cell is tapped, it goes fullscreen, and those common items should relocate (traslate) to the their initial state on the DetailVC .

ie, if "someRedLabel" it's in the right bottom corner on the detailVC , when i tap the cell in the collectionVC , "someRedLabel" should traslates from where it is at the moment, to the right bottom corner, as the cell expands to fullscreen.

I'm using the transitiondelegate, setting by hand frame to frame of all the different UI elements, from the current context to the DetailVC, it almost do what i want but always something fails (some does not animate, some does not relocate) and im thinking that maybe the approach it isn't the correct

I would like to know what is the correct approach to do this.

Thanks.

My suggestion to this is making a copy of your "redlabel", then add it to your second VC's view. If you don't know where to add it in the second view, you can use pointConvertToView or RectConvertToView methods.

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