Frosted Glass Effect

An added flourish to the custom alert is a newly introduced visual effect found in iOS 7 and highlighted in the Control Center—the frosted glass appearance. Apple provides this effect by default in a number of UIKit elements: UITabBar, UINavigationBar, and UIToolbar.

Outside the embedded implementation in these bars, no mechanism is available to include this effect in your own views. Apple has provided sample code, a UIImage category, that simulates this effect. Unfortunately, it pales in comparison to the built-in implementation. The category is only a close approximation, and worse, is much slower than the embedded version, rendering it unusable as a live effect.

To work around this limitation, Recipe 3-4 subclasses a ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.