I’ve got a UIButton that I create at runtime. I put a title on it and have a few states set for it. I DO NOT have an image set to the background and want to avoid this. So the button should simply be a custom button with text in the middle.
When I click on it I see 0 feedback that I clicked on it. I can set the text to change states, but I don’t get that grey highlighted color on top.
I’ve tried:
[button setShowsTouchWhenHighlighted:YES];
And get nothing. again I can set the title color to chagne based on the state but thats not really what I’m looking for. Any Ideas?
Thanks for any and all help.
change button type as:
UIButtonTypeRoundedRectinstead of
UIButtonTypeCustomUIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(20, 20, 200, 44); // position in the parent view and set the size of the button
[myButton setTitle:@"Click Me!" forState:UIControlStateNormal];
// add targets and actions
[myButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
// add to a view
[superView addSubview:myButton];