UIVisualEffects in 10mins
Slides from a talk I gave at Boulder iOS October Meetup
Summary
With iOS 8, Apple has provided a new technology which makes it very easy to create frosted, translucent overlays. These overlays are interactive and will reflect the state of activity beneath. This is an upgrade from previous technigues which involved creating static images and applying blur effects.
Usage
Instantiate an instance of UIVisualEffectView
and hand it an effect.
Presently, the only effects available are instances of either
UIBlurEffect
or UIVibrancyEffect
.
UIBlurEffects can be configured for dark, light, or extra light. Apply a
tintColor
to UIVisualEffectView
to make it fit properly in a
colorscheme.
UIVibrancyEffect is best used with text, or other controls that need to remain readable, as frosted overlays can obscure important details in the foreground.
Apply Vibrancy
To apply vibrancy, create another UIVisualEffectView
with an instance of
UIVibrancyEffect.
note Vibrancy needs to know about the current
UIBlurEffect
settings. Add the second UIVisualEffectView
configured for
vibrancy as a subview of the first. Just like UITableViewCell
,
the UIVisualEffectView
has a contentView
property for subviews.
Working Example
A working example complete with animations, blur and vibrancy effects is available here : UISpookyEffects on Github