Note that there are some explanatory texts on larger screens.

plurals
  1. POCoreGraphics - Blending only *part* of a view
    text
    copied!<p>I recently came across this brilliant article about improving scroll performance with UITableViewCells: <a href="http://engineering.twitter.com/2012/02/simple-strategies-for-smooth-animation.html" rel="noreferrer">http://engineering.twitter.com/2012/02/simple-strategies-for-smooth-animation.html</a> -- While many great tips can be found in this article, there is one in particular that has me intrigued:</p> <blockquote> <p>Tweets in Twitter for iPhone 4.0 have a drop shadow on top of a subtle textured background. This presented a challenge, as blending is expensive. <strong>We solved this by reducing the area Core Animation has to consider non-opaque, by splitting the shadow areas from content area of the cell.</strong></p> </blockquote> <p>Using the iOS Simulator, clicking <em>Debug</em> - <em>Color Blended Layers</em> would reveal something like this:</p> <p><img src="https://i.imgur.com/RX5C2.png" alt="TwitterTableViewCell"></p> <p>The areas marked in red are blended, and the green area is opaque. Great. What the article fails to mention is: How do I implement this? It is my understanding that a UIView is either opaque or it's not. It seems to me that the only way to accomplish this would be with subviews, but the article explicitly states that as being <em>a naive implementation</em>: </p> <blockquote> <p>Instead, our Tweet cells contain a single view with no subviews; a single drawRect: draws everything.</p> </blockquote> <p>So how do I section off what is opaque, and what is not in my single drawRect: method?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload