Skip to content

Instantly share code, notes, and snippets.

@conradev
Created January 27, 2014 19:28
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conradev/8655650 to your computer and use it in GitHub Desktop.
Save conradev/8655650 to your computer and use it in GitHub Desktop.
UIKit Blur Detection
//
// CKBlurDetection.h
//
// Created by Conrad Kramer on 1/23/14.
// Copyright (c) 2014 Kramer Software Productions, LLC. All rights reserved.
//
extern BOOL CKBlurEnabled();
//
// 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