Frage

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?

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top