From 07b4059cc3b4ddd44f8ec95d01d162627453e40c Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 24 Jan 2014 14:19:23 +0800 Subject: [PATCH] Prevent crash when used on iOS6 --- LMAlertView/LMAlertView.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LMAlertView/LMAlertView.m b/LMAlertView/LMAlertView.m index 2ad40d3..39f5779 100644 --- a/LMAlertView/LMAlertView.m +++ b/LMAlertView/LMAlertView.m @@ -114,7 +114,9 @@ - (void)setButtonsShouldStack:(BOOL)buttonsShouldStack - (void)setTintColor:(UIColor *)tintColor { _tintColor = tintColor; - self.window.tintColor = tintColor; + if ([self.window respondsToSelector:@selector(setTintColor:)]) { + self.window.tintColor = self.tintColor; + } } - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... @@ -430,7 +432,9 @@ - (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 ([self.window respondsToSelector:@selector(setTintColor:)]) { + self.window.tintColor = self.tintColor; + } LMEmbeddedViewController *viewController = [[LMEmbeddedViewController alloc] init]; viewController.alertView = self;