Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton not Blinking on Touch

I have a UIButton, created programmatically, inside a UIView (no other levels to the hierarchy). The button does respond to the touchUpInside event properly, but, for some reason, the text isn't exhibiting its normal "blink" behavior when touched. I'd like to get that back, if anyone knows what could cause this.

Other notes: I have userInteractionEnabled = TRUE and there are no custom animations in my code. Relevant instantiation code (UIColor names are from a custom category):

self.loginButton = [[UIButton alloc] init];
self.loginButton.backgroundColor = [UIColor MPBlackColor];
[self.loginButton setTitle:@"LOG IN" forState:UIControlStateNormal];
[self.loginButton setTitleColor:[UIColor MPGreenColor] forState:UIControlStateNormal];
self.loginButton.titleLabel.font = [UIFont fontWithName:@"Oswald-Bold" size:24.0f];
like image 618
Connor Neville Avatar asked Feb 10 '23 03:02

Connor Neville


1 Answers

The problem is that your custom color for the normal state applies also for the highlighted state, unless you give it a separate color for the highlighted state. This is true of all button state related values.

like image 187
matt Avatar answered Feb 24 '23 03:02

matt