Quite simple question here. How can I keep a NSButton highlighted? It seems that whenever the user presses my highlighted button开发者_如何学运维, the button becomes unhighlighted. Any suggestions?
Thanks in advance!
I think you are looking for:
[[btnFilter1 cell] setHighlighted:YES];
If you're setting it up in a XIB/NIB, you can set the type of the button to toggle/push on push off/etc.
I'm guessing you want an almost one way toggle button? You could change the UIControlStateNormal to what the UIControlStateHighlighted.
-(void)buttonPressed
{
[button setImage:[UIImage imageNamed:@"highlighted_image.png"] forState:UIControlStateNormal];
}
精彩评论