Hysen Labs
Open-source project
yeahdongcn/RSTransitionEffect avatar
yeahdongcn

RSTransitionEffect

Re-implement mayuur's MJTransitionEffect(https://github.com/mayuur/MJTransitionEffect) and provide default data binding for UITableViewCell and detail view controller and solve the white screen problem. All images, data source are taken from mayuur's MJTransitionEffect.

100 stars16 forksObjective-CMIT
01
DEEP OPEN-SOURCE ANALYSIS

RSTransitionEffect: a table cell animation that fixes the white screen

RSTransitionEffect reimplements MJTransitionEffect with default data binding for table cells and detail views, converting cell frames to screen coordinates so the push animation stops flashing white.

02
DEEP OPEN-SOURCE ANALYSIS

The problem this project re-implements

RSTransitionEffect rebuilds mayuur's MJTransitionEffect and adds default data binding for table cells and detail view controllers. The reason for the reimplementation is practical: the original had a white screen problem, and this version sets out to fix it. The images and the data source come straight from mayuur's project, so the reimplementation carries the same look while changing the mechanics underneath.

03
DEEP OPEN-SOURCE ANALYSIS

Frames are the heart of it

The implementation introduces source and target frames for the transition view controller. Cells have to animate from where they sit on screen to where the detail view lands, so the project converts the cell's own frame, its text label, its detail label, and its image view into absolute screen coordinates. With those frames in hand, the transition has a real start and end point.

04
DEEP OPEN-SOURCE ANALYSIS

The pieces involved

Three pieces do the work. RSBasicItem is the data item for a cell, holding text, detail text, and an image. A UITableView category converts the cell and its labels into screen frames. RSTransitionEffectViewController handles the data binding and the animations.

05
DEEP OPEN-SOURCE ANALYSIS

Wiring it up in a storyboard

Setup happens in a storyboard and a delegate. A detail view controller subclasses RSTransitionEffectViewController, with predefined outlets linked to the current views. In the table view delegate, the row's source frames are passed in along with the item, and the new controller is pushed. The README's example deselects the row first, and then it is done: the detail view appears with the transition effect. The push itself is not animated, because the transition controller supplies its own animation.

07
DEEP OPEN-SOURCE ANALYSIS

Official sources

08
Community notes

Community notes