@@ -17,28 +17,34 @@ - (void) configureFlatStepperWithColor:(UIColor *)color
17
17
disabledColor : (UIColor *)disabledColor
18
18
iconColor : (UIColor *)iconColor {
19
19
20
- UIImage *normalImage = [UIImage imageWithColor: color cornerRadius: 2.0 ];
21
- UIImage *highlightedImage = [UIImage imageWithColor: highlightedColor cornerRadius: 2.0 ];
22
- UIImage *disabledImage = [UIImage imageWithColor: disabledColor cornerRadius: 2.0 ];
23
- [self setBackgroundImage: normalImage forState: UIControlStateNormal];
24
- [self setBackgroundImage: highlightedImage forState: UIControlStateHighlighted];
25
- [self setBackgroundImage: disabledImage forState: UIControlStateDisabled];
26
- [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
27
- forLeftSegmentState: UIControlStateNormal
28
- rightSegmentState: UIControlStateNormal];
29
- [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
30
- forLeftSegmentState: UIControlStateHighlighted
31
- rightSegmentState: UIControlStateNormal];
32
- [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
33
- forLeftSegmentState: UIControlStateNormal
34
- rightSegmentState: UIControlStateHighlighted];
20
+ // iOS 6 compat check
21
+ if ([self respondsToSelector: @selector (setBackgroundImage:forState: )])
22
+ {
35
23
36
- UIImage *plusImage = [UIImage stepperPlusImageWithColor: iconColor];
37
- UIImage *minusImage = [UIImage stepperMinusImageWithColor: iconColor];
38
- [self setIncrementImage: plusImage forState: UIControlStateNormal];
39
- [self setIncrementImage: plusImage forState: UIControlStateDisabled];
40
- [self setDecrementImage: minusImage forState: UIControlStateNormal];
41
- [self setDecrementImage: minusImage forState: UIControlStateDisabled];
24
+ UIImage *normalImage = [UIImage imageWithColor: color cornerRadius: 2.0 ];
25
+ UIImage *highlightedImage = [UIImage imageWithColor: highlightedColor cornerRadius: 2.0 ];
26
+ UIImage *disabledImage = [UIImage imageWithColor: disabledColor cornerRadius: 2.0 ];
27
+ [self setBackgroundImage: normalImage forState: UIControlStateNormal];
28
+ [self setBackgroundImage: highlightedImage forState: UIControlStateHighlighted];
29
+ [self setBackgroundImage: disabledImage forState: UIControlStateDisabled];
30
+ [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
31
+ forLeftSegmentState: UIControlStateNormal
32
+ rightSegmentState: UIControlStateNormal];
33
+ [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
34
+ forLeftSegmentState: UIControlStateHighlighted
35
+ rightSegmentState: UIControlStateNormal];
36
+ [self setDividerImage: [UIImage imageWithColor: highlightedColor cornerRadius: 0 ]
37
+ forLeftSegmentState: UIControlStateNormal
38
+ rightSegmentState: UIControlStateHighlighted];
39
+
40
+ UIImage *plusImage = [UIImage stepperPlusImageWithColor: iconColor];
41
+ UIImage *minusImage = [UIImage stepperMinusImageWithColor: iconColor];
42
+ [self setIncrementImage: plusImage forState: UIControlStateNormal];
43
+ [self setIncrementImage: plusImage forState: UIControlStateDisabled];
44
+ [self setDecrementImage: minusImage forState: UIControlStateNormal];
45
+ [self setDecrementImage: minusImage forState: UIControlStateDisabled];
46
+
47
+ }
42
48
43
49
}
44
50
0 commit comments