Created
January 27, 2014 19:28
-
-
Save conradev/8655650 to your computer and use it in GitHub Desktop.
UIKit Blur Detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CKBlurDetection.h | |
// | |
// Created by Conrad Kramer on 1/23/14. | |
// Copyright (c) 2014 Kramer Software Productions, LLC. All rights reserved. | |
// | |
extern BOOL CKBlurEnabled(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CKBlurDetection.m | |
// | |
// Created by Conrad Kramer on 1/23/14. | |
// Copyright (c) 2014 Kramer Software Productions, LLC. All rights reserved. | |
// | |
static NSArray * CKGetFilters(UIView *view) { | |
NSMutableArray *filters = [NSMutableArray arrayWithArray:view.layer.filters]; | |
for (UIView *subview in view.subviews) { | |
[filters addObjectsFromArray:CKGetFilters(subview)]; | |
} | |
return [filters copy]; | |
} | |
BOOL CKBlurEnabled() { | |
UIToolbar *toolbar = [[UIToolbar alloc] init]; | |
[toolbar setNeedsLayout]; | |
[toolbar layoutIfNeeded]; | |
return [[CKGetFilters(toolbar) valueForKey:@"name"] containsObject:@"gaussianBlur"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment