I am setting up the following UIButton (in tableview cell) for the intention of making it look like an URL link that’s clickable
UIButton *buttonUserName = [UIButton buttonWithType:UIButtonTypeCustom];
buttonUserName.frame = CGRectMake(10, 10, 280, 20);
[buttonUserName setTitle:@"test" forState:UIControlStateNormal];
[buttonUserName setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[buttonUserName setEnabled:YES];
buttonUserName.userInteractionEnabled = YES;
[buttonUserName addTarget:self action:@selector(user:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:buttonUserName];
The button and title does show up, but it has not click effect (visually) when I tap it. Am I missing anything?
Set the the visually feedbacks you want to the button state
UIControlStateHighlightedfor example: title color
and some else title, background image, image etc.