I have a UIButton
which remains selected when I select that button. Here is my code:
- (IBAction)cloudclick:(UIButton *)sender {
UIImage *bgImage = [UIImage imageNamed:@"black_cloud.png"];
UIButton *tmpButton = (UIButton *)[self.view viewWithTag:sender.tag];
[tmpButton setBackgroundImage:bgImage forState:UIControlStateSelected];
}
But it does not remain selected when I click the button. It changes the background but it does not remain as selected button.
you have to write one line after your code
- (IBAction)cloudclick:(UIButton *)sender {
...
[tmpButton setSelected:YES];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With