NSButton, Templates, images…
NSButton, Templates, images…
- Subject: NSButton, Templates, images…
- From: Alex Kac <email@hidden>
- Date: Tue, 24 Jun 2014 16:31:36 -0600
I’m sure I’m missing something simple. Reading the docs, reading some stack-overflow comments, and a few posts on this list from years ago, it seems like I am missing something.
I have an NSButton with an image. I’d like to have the button look etched when unselected - and tinted blue when selected just like the Xcode mini-tabbar here:
https://www.dropbox.com/s/b1f9kxe5ww25ep7/Screenshot 2014-06-24 16.24.55.png
I’m doing this in code, not in IB. I’m using an NSButton subclass:
[self setButtonType: NSToggleButton];
[self setBordered: NO];
[self setTitle: @""];
[self.cell setImageScaling: NSImageScaleProportionallyDown];
self.bezelStyle = NSShadowlessSquareBezelStyle;
self.focusRingType = NSFocusRingTypeNone;
And on the image, we’re setting the setTemplate:YES property on it.
[iconImage setTemplate:YES];
According to several posts on this list, a bezel-less NSButton that’s a toggle button, should give me what I’m looking for, but its not. The obvious other option is to just create an alternate image…which I’m not against, but it just seems like it would be better to use a built-in system if one exists - or does one?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden