bmende
bmende

Reputation: 741

How to set UIButton's highlighted property to NO?

While i am touching a UIButton how can I make it not highlighted. I don't want to just completely shun the highlighted feature however. I just want to make the highlighted stop when I begin to drag. I have tried this though

-(IBAction)stopHighlighting:(UIButton *)sender// i hooked this up to IB for touchDragInside
{

sender.highlighted=NO;
//this doesnt work at all
}

Upvotes: 0

Views: 156

Answers (1)

borrrden
borrrden

Reputation: 33423

The problem is that the system will override your logic. It calls the target method before darkening the image for highlight so basically you will set it to NO and then it will set it back to YES and you will see nothing. You have two options:

1) Use dispatch_async to delay your call to highlight until after the system has set it.

2) Disable the runtime highlighting and switch your images manually.

Upvotes: 1

Related Questions