-
-
Save indyfromoz/6600676 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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.delegate.window 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