I've been wrestling with applying my custom styles (example) to the OSX desktop app I've been building, and I'm wondering what the paradigms/idioms are for doing this.
- I'm using X/Nibs for laying out the components on the windows
- I'm setting the components' class to a custom subclass of the out-of-the-box component (
,NSTextField
, andNSButton
for example)NSPopUpButton - I'm overriding
in some,viewWillDraw
in others and making them allinit?
and setting attributes on those layerswantsLayer
This seems extremely clumsy at best, and some visual things are impossible to handle this way, like adding padding to an
NSTextField.A lot of people are describing how to do certain changes to visual components in
viewDidLoadwith a reference to a component, which seems very tedious if you have button/textfield styles that apply to all in the project. It seems like every visual change I've made with subclassing has been a nightmare, and there's no pattern for what visual changes are made where for different components. Subclassing seems like the best option for any size of project if you want to make your code reusable, but am I missing something? Is there some other pattern or idiom that I'm missing?