UIBackdropView

From iPhone Development Wiki
Revision as of 19:08, 18 May 2014 by Jon889 (talk | contribs) (added more style numbers)
Jump to: navigation, search

_UIBackdropView is a private class in UIKit.framework (iOS 7.0+), a subclass of UIView, which is used for the popular blur effects.

It uses a CABackdropLayer with a gaussianBlur CAFilter.[1]

_UIBackdropView uses the settings for its setup. Here's all settings class available in iOS 7.0

Class name Style number Comments/Used by
_UIBackdropViewSettingsLight 0 (Also 1000, 1003, and 2020)
_UIBackdropViewSettingsDark 1 (Also 1001, 1100, 2030)
_UIBackdropViewSettingsBlur 2 Common blurring
_UIBackdropViewSettingsColorSample 2000
_UIBackdropViewSettingsUltraLight 2010 Some alert views in Settings app & many white UIs
_UIBackdropViewSettingsLight 2020 (Also 10090, 10100)
_UIBackdropViewSettingsLightLow 2029
_UIBackdropViewSettingsDark 2030 iOS 7 Notification Center (?) (Also 11050, 11060)
_UIBackdropViewSettingsDarkWithZoom 2031
_UIBackdropViewSettingsDarkLow 2039
_UIBackdropViewSettingsColored 2040 (Also 10091, 10092, 10120)
_UIBackdropViewSettingsUltraDark 2050 (Also 11070)
_UIBackdropViewSettingsAdaptiveLight 2060 iOS 7 Control Center
_UIBackdropViewSettingsSemiLight 2070
_UIBackdropViewSettingsFlatSemiLight 2071
_UIBackdropViewSettingsUltraColored 2080
_UIBackdropViewSettingsPasscodePaddle 3900
_UIBackdropViewSettingsLightKeyboard 3901

There are many ways to create the settings object

_UIBackdropViewSettings *settings = (_UIBackdropViewSettings *)[[[_UIBackdropViewSettingsSemiLight alloc] init] autorelease];

_UIBackdropViewSettings *settings = [_UIBackdropViewSettings settingsForStyle:2070];

_UIBackdropViewSettings *settings = [_UIBackdropViewSettings settingsForPrivateStyle:2070];

_UIBackdropViewSettings *settings = [[[_UIBackdropViewSettings alloc] initWithDefaultsValue] autorelease];

Creating _UIBackdropView (Blur view) object

// Creating blur view using settings object
_UIBackdropViewSettings *settings = [_UIBackdropViewSettings settingsForStyle:2060];

// initialization of the blur view
_UIBackdropView *blurView = [[_UIBackdropView alloc] initWithFrame:CGRectZero
                                              autosizesToFitSuperview:YES settings:settings];
// another way for initialization
_UIBackdropView *blurView = [[_UIBackdropView alloc] initWithSettings:settings];

// or without settings object implementation
_UIBackdropView *blurView = [[_UIBackdropView alloc] initWithStyle:2060];

[someView addSubview:backView];
[blurView release];

Blur Quality

There are only two qualities available.

  • low
  • default (Assumed to be "medium")

You can set it like this:

[blurView setBlurQuality:@"low"];

Tinting blur view

[blurView setRequiresColorStatistics:YES];
[blurView setUsesColorTintView:YES];
[blurView setColorTint:[UIColor cyanColor]];
[blurView setColorTintAlpha:0.8];
[blurView setColorTintMaskAlpha:0.7];

Applying blur settings

You can config the settings parameter then apply and update the blur view.

_UIBackdropViewSettings *newSettings = [_UIBackdropView settingsForPrivateStyle:0];

// Whatever configuration for the settings

[blurView applySettings:newSettings];
// or
[blueView computeAndApplySettings:newSettings];

Getting/Parsing all _UIBackdropView objects at runtime

NSArray *blurViews = [_UIBackdropView allBackdropViews];

for (_UIBackdropView *view in blurViews) {
     // do any _UIBackdropView configuration here
}

References