Difference between revisions of "UIBackdropView"

From iPhone Development Wiki
Jump to: navigation, search
m (Example: More common.)
m (UIBackDropView -> UIBackdropView)
Line 7: Line 7:
 
<source lang="objc">
 
<source lang="objc">
  
         Class UIBackDropView = objc_getClass("_UIBackdropView");
+
         Class UIBackdropView = objc_getClass("_UIBackdropView");
         if (UIBackDropView)
+
         if (UIBackdropView)
 
         {
 
         {
 
             id settings = nil;
 
             id settings = nil;
Line 18: Line 18:
 
             }
 
             }
 
              
 
              
             UIView * backView = (UIView *) [[UIBackDropView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)
+
             UIView * backView = (UIView *) [[UIBackdropView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)
 
                                                         autosizesToFitSuperview:YES
 
                                                         autosizesToFitSuperview:YES
 
                                                                         settings:settings];
 
                                                                         settings:settings];

Revision as of 18:02, 14 May 2014

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

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

Example

        Class UIBackdropView = objc_getClass("_UIBackdropView");
        if (UIBackdropView)
        {
            id settings = nil;
            
            Class _UIBackdropViewSettings = objc_getClass("_UIBackdropViewSettings");
            if (_UIBackdropViewSettings)
            {
                settings = [_UIBackdropViewSettings settingsForStyle:2060]; // 2060 is the system control center background view style
            }
            
            UIView * backView = (UIView *) [[UIBackdropView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)
                                                         autosizesToFitSuperview:YES
                                                                        settings:settings];
            [self addSubview:backView];
            [backView release];
        }

References