Joshua
Joshua

Reputation: 15510

How do you change the look of a check box?

I would like to create a custom check box that functions just like a normal check box but looks different, at the moment I am using normal check box's, is there a way to do this.

P.S This is Cocoa i am talking about.

Upvotes: 3

Views: 1713

Answers (2)

Marc Charbonneau
Marc Charbonneau

Reputation: 40517

You need to override NSButtonCell. You'll use drawInteriorWithFrame:inView: or a simililar method to do your custom drawing. If you've never used custom cells before it can be a bit of a learning experience, but there's a lot of good advice out there, like this page to start with.

You could also take a look at an open source framework like BGHUDAppKit for an example.

Upvotes: 6

Alex
Alex

Reputation: 7612

As a sidenote, if the only thing you need to do is change the 'check' image from the default one provided by Apple, then go to the properties of the NSButton in XCode/Interface Builder and select an Image and an Alternate Image. Same thing goes for radio buttons.

Upvotes: 4

Related Questions