blob: 6273fbee8365bc23848272774f14ee20d001374b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#import "Macros.h"
#import "UIButton+RuntimeAttributes.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@implementation UIButton (RuntimeAttributes)
- (void)setLocalizedText:(NSString *)localizedText {
[self setTitle:L(localizedText) forState:UIControlStateNormal];
[self setTitle:L(localizedText) forState:UIControlStateDisabled];
}
- (NSString *)localizedText {
return L([self titleForState:UIControlStateNormal]);
}
- (void)setFontName:(NSString *)fontName
{
self.titleLabel.font = [UIFont fontWithName:fontName];
}
- (void)setTextColorName:(NSString *)colorName
{
[self setTitleColor:[UIColor colorWithName:colorName] forState:UIControlStateNormal];
}
- (void)setTextColorHighlightedName:(NSString *)colorName
{
[self setTitleColor:[UIColor colorWithName:colorName] forState:UIControlStateHighlighted];
}
- (void)setBackgroundColorName:(NSString *)colorName
{
[self setBackgroundColor:[UIColor colorWithName:colorName] forState:UIControlStateNormal];
}
- (void)setBackgroundHighlightedColorName:(NSString *)colorName
{
[self setBackgroundColor:[UIColor colorWithName:colorName] forState:UIControlStateHighlighted];
}
- (void)setBackgroundColor:(UIColor *)color forState:(UIControlState)state
{
[self setBackgroundImage:[UIImage imageWithColor:color] forState:state];
}
@end
|