Skip to content

Instantly share code, notes, and snippets.

@skeeet
Forked from steipete/UIKitLegacyDetector.m
Created October 17, 2013 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skeeet/7028448 to your computer and use it in GitHub Desktop.
Save skeeet/7028448 to your computer and use it in GitHub Desktop.
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
PSPDFAssertIfNotMainThread();
// If your app is running in legacy mode, tintColor will be nil - else it must be set to some color.
if (UIApplication.sharedApplication.keyWindow) {
isUIKitFlatMode = [UIApplication.sharedApplication.keyWindow performSelector:@selector(tintColor)] != nil;
}else {
// Possible that we're called early on (e.g. when used in a Storyboard). Adapt and use a temporary window.
isUIKitFlatMode = [[UIWindow new] performSelector:@selector(tintColor)] != nil;
}
}
});
return isUIKitFlatMode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment