I set an images for button\'s states Normal,Highlighted and Selected, but when the button in selected state and I press/highlight it I didn\'t see my highlighted image but j
Where you want to call from
[button addTarget:self action:@selector(test:) forControlEvents:UIControlEventTouchUpInside];
The method:
-(void)test:(id)sender{
UIButton *button=(UIButton *)sender;
if (_togon){
[button setTitleColor:UIColorFromRGB(89,89, 89) forState:UIControlStateNormal];
_togon=NO;
}
else{
[button setTitleColor:UIColorFromRGB(28, 154, 214) forState:UIControlStateNormal];
_togon=YES;
}
}
Credit above to Jorge but I improved it a bit giving the full working solution