@@ -71,40 +71,45 @@ - (UIFont*)_font
71
71
72
72
- (void )_setState : (GradientButtonState)state
73
73
{
74
- switch (state) {
75
- case GradientButtonStateNormal:
76
- self.gradientLayer .colors =
77
- [NSArray arrayWithObjects:
78
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.7 ].CGColor ,
79
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.4 ].CGColor ,
80
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.3 ].CGColor ,
81
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.0 ].CGColor ,
82
- nil ];
83
- self.textLayer .foregroundColor = self.textColor .CGColor ;
84
- break ;
85
-
86
- case GradientButtonStateHighlighted:
87
- self.gradientLayer .colors =
88
- [NSArray arrayWithObjects:
89
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.5 ].CGColor ,
90
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.2 ].CGColor ,
91
- (id )[UIColor colorWithWhite: 0.0 alpha: 0.05 ].CGColor ,
92
- (id )[UIColor colorWithWhite: 0.0 alpha: 0.1 ].CGColor ,
93
- nil ];
94
- self.textLayer .foregroundColor = self.textColor .CGColor ;
95
- break ;
96
-
97
- case GradientButtonStateDisabled:
98
- self.gradientLayer .colors =
99
- [NSArray arrayWithObjects:
100
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.7 ].CGColor ,
101
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.4 ].CGColor ,
102
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.3 ].CGColor ,
103
- (id )[UIColor colorWithWhite: 1.0 alpha: 0.0 ].CGColor ,
104
- nil ];
105
- self.textLayer .foregroundColor = [UIColor lightGrayColor ].CGColor ;
106
- break ;
74
+ [CATransaction begin ];
75
+ [CATransaction setValue: (id )kCFBooleanTrue forKey: kCATransactionDisableActions ];
76
+ {
77
+ switch (state) {
78
+ case GradientButtonStateNormal:
79
+ self.gradientLayer .colors =
80
+ [NSArray arrayWithObjects:
81
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.7 ].CGColor ,
82
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.4 ].CGColor ,
83
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.3 ].CGColor ,
84
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.0 ].CGColor ,
85
+ nil ];
86
+ self.textLayer .foregroundColor = self.textColor .CGColor ;
87
+ break ;
88
+
89
+ case GradientButtonStateHighlighted:
90
+ self.gradientLayer .colors =
91
+ [NSArray arrayWithObjects:
92
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.5 ].CGColor ,
93
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.2 ].CGColor ,
94
+ (id )[UIColor colorWithWhite: 0.0 alpha: 0.05 ].CGColor ,
95
+ (id )[UIColor colorWithWhite: 0.0 alpha: 0.1 ].CGColor ,
96
+ nil ];
97
+ self.textLayer .foregroundColor = self.textColor .CGColor ;
98
+ break ;
99
+
100
+ case GradientButtonStateDisabled:
101
+ self.gradientLayer .colors =
102
+ [NSArray arrayWithObjects:
103
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.7 ].CGColor ,
104
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.4 ].CGColor ,
105
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.3 ].CGColor ,
106
+ (id )[UIColor colorWithWhite: 1.0 alpha: 0.0 ].CGColor ,
107
+ nil ];
108
+ self.textLayer .foregroundColor = [UIColor lightGrayColor ].CGColor ;
109
+ break ;
110
+ }
107
111
}
112
+ [CATransaction commit ];
108
113
}
109
114
- (void )_setup
110
115
{
0 commit comments