Skip to content

Commit 5515854

Browse files
committed
Added tinted simple button shape
1 parent d3eff6b commit 5515854

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

SIAlertView/SIAlertView.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#import "UIWindow+SIUtils.h"
1111
#import <QuartzCore/QuartzCore.h>
1212

13+
#import "UIImage_Tint.h"
14+
1315
NSString *const SIAlertViewWillShowNotification = @"SIAlertViewWillShowNotification";
1416
NSString *const SIAlertViewDidShowNotification = @"SIAlertViewDidShowNotification";
1517
NSString *const SIAlertViewWillDismissNotification = @"SIAlertViewWillDismissNotification";
@@ -1182,12 +1184,18 @@ - (UIButton *)buttonForItemIndex:(NSUInteger)index
11821184
[button setTitleColor:[self.destructiveButtonColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted];
11831185
break;
11841186
case SIAlertViewButtonTypeDefault:
1185-
default:
1186-
normalImage = [UIImage imageNamed:@"SIAlertView.bundle/button-default"];
1187-
highlightedImage = [UIImage imageNamed:@"SIAlertView.bundle/button-default-d"];
1188-
[button setTitleColor:self.buttonColor forState:UIControlStateNormal];
1189-
[button setTitleColor:[self.buttonColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted];
1187+
default: {
1188+
// normalImage = [UIImage imageNamed:@"SIAlertView.bundle/button-default"];
1189+
// highlightedImage = [UIImage imageNamed:@"SIAlertView.bundle/button-default-d"];
1190+
// [button setTitleColor:self.buttonColor forState:UIControlStateNormal];
1191+
// [button setTitleColor:[self.buttonColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted];
1192+
UIColor *tintColor = [[SIAlertView appearance] tintColor];
1193+
normalImage = [[UIImage imageNamed:@"SimpleButton"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
1194+
normalImage =
1195+
[normalImage imageTintedWithColor:tintColor];
1196+
[button setTitleColor:tintColor forState:UIControlStateNormal];
11901197
break;
1198+
}
11911199
}
11921200
CGFloat hInset = floorf(normalImage.size.width / 2);
11931201
CGFloat vInset = floorf(normalImage.size.height / 2);

SIAlertView/SimpleButton.png

4.06 KB
Loading

SIAlertView/[email protected]

4.22 KB
Loading

0 commit comments

Comments
 (0)