Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions LMAlertView/LMAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "LMEmbeddedViewController.h"
#import "LMModalItemTableViewCell.h"
#import <CAAnimation+Blocks.h>
#import "UIDevice+SystemVersionNumber.h"

@interface LMAlertView ()

Expand Down Expand Up @@ -114,7 +115,9 @@ - (void)setButtonsShouldStack:(BOOL)buttonsShouldStack
- (void)setTintColor:(UIColor *)tintColor
{
_tintColor = tintColor;
self.window.tintColor = tintColor;

if([UIDevice currentDevice].systemVersionNumber >= 7.0)
self.window.tintColor = tintColor;
}

- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
Expand Down Expand Up @@ -430,7 +433,8 @@ - (void)show

// You can have more than one UIWindow in the view hierachy, which is how UIAlertView works
self.window = [[UIWindow alloc] initWithFrame:[appDelegate window].frame];
self.window.tintColor = self.tintColor;
if([UIDevice currentDevice].systemVersionNumber >= 7.0)
self.window.tintColor = self.tintColor;

LMEmbeddedViewController *viewController = [[LMEmbeddedViewController alloc] init];
viewController.alertView = self;
Expand Down
14 changes: 14 additions & 0 deletions LMAlertView/UIDevice+SystemVersionNumber.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// UIDevice+SystemVersionNumber.h
// LMAlertViewDemo
//
// Created by Lin Cheng Kai on 14/4/24.
// Copyright (c) 2014年 Bestir Ltd. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIDevice (SystemVersionNumber)
@property (nonatomic, readonly) float systemVersionNumber;

@end
33 changes: 33 additions & 0 deletions LMAlertView/UIDevice+SystemVersionNumber.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// UIDevice+SystemVersionNumber.m
// LMAlertViewDemo
//
// Created by Lin Cheng Kai on 14/4/24.
// Copyright (c) 2014年 Bestir Ltd. All rights reserved.
//

#import "UIDevice+SystemVersionNumber.h"
#import <objc/runtime.h>

const char SYS_VER_NUM_KEY;
@implementation UIDevice (SystemVersionNumber)
- (float)systemVersionNumber
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *sysVer = [UIDevice currentDevice].systemVersion;
NSError *error = nil;
NSRegularExpression *regexp =[NSRegularExpression regularExpressionWithPattern:@"\\d.\\d" options:0 error:&error];
NSTextCheckingResult *result = [regexp firstMatchInString:sysVer options:0 range:NSMakeRange(0, [sysVer length])];

NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
numFormatter.numberStyle = NSNumberFormatterDecimalStyle;
NSNumber *versionNumber = [numFormatter numberFromString:[sysVer substringWithRange:result.range]];

objc_setAssociatedObject(self, &SYS_VER_NUM_KEY, versionNumber, OBJC_ASSOCIATION_ASSIGN);
});

NSNumber *sysVerNum = objc_getAssociatedObject(self, &SYS_VER_NUM_KEY);
return [sysVerNum floatValue];
}
@end
6 changes: 6 additions & 0 deletions LMAlertViewDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
16CCDFA91853296D0059DE8B /* LMTwitterLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 16CCDFA81853296D0059DE8B /* LMTwitterLocationViewController.m */; };
16CCDFAC18544C6F0059DE8B /* LMNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 16CCDFAB18544C6F0059DE8B /* LMNavigationController.m */; };
16CCDFD2185832520059DE8B /* LMModalItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 16CCDFD1185832520059DE8B /* LMModalItemTableViewCell.m */; };
984508EE19090DFA0017DE75 /* UIDevice+SystemVersionNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 984508ED19090DFA0017DE75 /* UIDevice+SystemVersionNumber.m */; };
E017F5E695B446B2B1B5314D /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6ABB7B0B6944B929C0CFAFE /* libPods.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -67,6 +68,8 @@
16CCDFD0185832520059DE8B /* LMModalItemTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LMModalItemTableViewCell.h; path = ../LMAlertView/LMModalItemTableViewCell.h; sourceTree = "<group>"; };
16CCDFD1185832520059DE8B /* LMModalItemTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LMModalItemTableViewCell.m; path = ../LMAlertView/LMModalItemTableViewCell.m; sourceTree = "<group>"; };
1FE7E8F0E7304B2287950B17 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
984508EC19090DFA0017DE75 /* UIDevice+SystemVersionNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+SystemVersionNumber.h"; path = "LMAlertView/UIDevice+SystemVersionNumber.h"; sourceTree = SOURCE_ROOT; };
984508ED19090DFA0017DE75 /* UIDevice+SystemVersionNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+SystemVersionNumber.m"; path = "LMAlertView/UIDevice+SystemVersionNumber.m"; sourceTree = SOURCE_ROOT; };
B6ABB7B0B6944B929C0CFAFE /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -173,6 +176,8 @@
16CCDFAA18544C6F0059DE8B /* LMNavigationController.h */,
16CCDFAB18544C6F0059DE8B /* LMNavigationController.m */,
169103CD183311F3003DF9E6 /* Radial.png */,
984508EC19090DFA0017DE75 /* UIDevice+SystemVersionNumber.h */,
984508ED19090DFA0017DE75 /* UIDevice+SystemVersionNumber.m */,
);
name = LMAlertView;
path = LMAlertViewDemo;
Expand Down Expand Up @@ -285,6 +290,7 @@
16CCDFAC18544C6F0059DE8B /* LMNavigationController.m in Sources */,
16CCDFA91853296D0059DE8B /* LMTwitterLocationViewController.m in Sources */,
16B47FC7183A33E800A06371 /* CALayer+ModalAlert.m in Sources */,
984508EE19090DFA0017DE75 /* UIDevice+SystemVersionNumber.m in Sources */,
16CCDFD2185832520059DE8B /* LMModalItemTableViewCell.m in Sources */,
165F9F781831632C00037E82 /* main.m in Sources */,
165F9F7C1831632C00037E82 /* LMAppDelegate.m in Sources */,
Expand Down
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:git: https://github.com/lmcd/LMFixedTextView.git

SPEC CHECKSUMS:
CAAnimationBlocks: b70f877c5b92734abef270152187d3287d84e8f8
EDStarRating: 6761f41fd040f1cde155e2885dddc96461620f67
CAAnimationBlocks: 0b18c88fcdffc0b8bb5e4c2ef57096f85119bb4d
EDStarRating: 4954b62647884e7b2d37c4720d4a1f758b5a3435
LMFixedTextView: 794f1423096e30f88a856ef49a791af08e5c6efe
RBBAnimation: e7f31ed62f760f3caf120b5d943267bd9a8e1f64

COCOAPODS: 0.28.0
COCOAPODS: 0.32.1