Question

I'm working on project which based on macruby and hotcocoa framework. I don't know objective c. In my project I would like to change color of button (NSButton). Do you know how to achieve this using hotcocoa mappers or macruby?

Was it helpful?

Solution

Setting the background color of NSButton is not directly supported. A robust way to create a customized button is to subclass NSButton and override drawRect:. Another way is to customize the button using CALayers.

layer = CALayer.layer
layer.backgroundColor = NSColor.orangeColor.CGColor
button.setLayer layer
button.setWantsLayer true
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top