Skip to content

Commit 8f03c4b

Browse files
committed
Merge pull request #21 from masgharneya/master
updated JSBadgeViewIsUIKitFlatMode to work in iOS 7.1
2 parents 0a9fcc8 + f837f33 commit 8f03c4b

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

JSBadgeView/JSBadgeView.m

+7-13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ of this software and associated documentation files (the "Software"), to deal
2323
#import "JSBadgeView.h"
2424

2525
#import <QuartzCore/QuartzCore.h>
26+
#include <mach-o/dyld.h>
2627

2728
#if !__has_feature(objc_arc)
2829
#error JSBadgeView must be compiled with ARC.
@@ -54,19 +55,12 @@ static BOOL JSBadgeViewIsUIKitFlatMode(void)
5455
#ifndef kCFCoreFoundationVersionNumber_iOS_7_0
5556
#define kCFCoreFoundationVersionNumber_iOS_7_0 847.2
5657
#endif
57-
58-
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0)
59-
{
60-
// If your app is running in legacy mode, tintColor will be nil - else it must be set to some color.
61-
if (UIApplication.sharedApplication.keyWindow)
62-
{
63-
isUIKitFlatMode = [UIApplication.sharedApplication.keyWindow performSelector:@selector(tintColor)] != nil;
64-
}
65-
else
66-
{
67-
// Possible that we're called early on (e.g. when used in a Storyboard). Adapt and use a temporary window.
68-
isUIKitFlatMode = [[[UIWindow alloc] init] performSelector:@selector(tintColor)] != nil;
69-
}
58+
#ifndef UIKitVersionNumber_iOS_7_0
59+
#define UIKitVersionNumber_iOS_7_0 0xB57
60+
#endif
61+
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7.
62+
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
63+
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0;
7064
}
7165
});
7266

0 commit comments

Comments
 (0)