Dillion / iOS-Flip-Transform

Core Animation framework for navigating data by flipping
919 stars 155 forks source link

Create Layers on demand to handle transparent PNGs #12

Open florianpilz opened 12 years ago

florianpilz commented 12 years ago

Hi, we're using iOS-Flip-Transform for a digital clock. Your framework is great, but it has one major drawback: Transparency. We used transparent pictures for each digit with a rounded corner (using transparency). Due to the transparency, all layers of the FlipView are rendered (since all are visible through the transparent corners - even though there is just another transparent corner beneath), i.e. 410 layers in our case. As you can imagine, drawing the clock the first time is slow and visible to the user.

Our solution will be to use non-transparent pictures and give up on rounded corners. The proper solution, which is currently not supported by the framework, would be to create the layers on demand, i.e. only create & draw the frontmost digit with its 10 layers and don't rely on the visible surface determination of Core Animation to prevent drawing of layers beneath the frontmost one.

Dillion commented 12 years ago

Indeed the current version needs to be better structured. Ideally only 3 animation frames (the view currently shown, the next one and the previous) need to be created and rendered at anytime, and all the layer info stored in a collection with methods for insertion, deletion and reordering. Pull requests welcome! :)