Manually setting a UIButton state

there are also the states:

   button.highlighted = NO;
   button.selected = NO;

Objective C:

button.selected = Yes;
button.highlighted = NO;
button.enabled = Yes;

Swift 4:

button.isSelected = true 
button.isEnabled = true

Also you can use:(swift 4)

 if (button.state == .selected) {
   //do something
 }

Did you try button.enabled = NO;?

Swift 5.0

button.isEnabled = false

You can manually set state of UIButton.

UIButton *btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];

if(btncheck isselected])
{
    btncheck.selected=FALSE;
}
else
{
    btncheck.selected=TRUE;
}

You can do operation on UIButton as per your requirement like perform some action when UIButton is selected and while not selected.

Hope this will help you....