Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Marimuthu

macrumors member
Original poster
Oct 18, 2010
43
0
Hi All,

I am developing an MAC application in Snow Leopard.
I want to subclass NSButtonCell to get the desired look and feel. I found many sample projects which subclass NSButtonCell class (and over-ride required methods) and but they are linked to the button object on the app using Interface Builder. With this IB linking, all I need to do is implement methods like - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
and drawImage and the framework will take care of calling the methods.

In my case, I need to dynamically create NSButton object as the number of buttons that I need to create vary from time to time. Also I need to dynamically skin each button with an image file. How do I do this without using IB?

Regards,
 
Hi All,

I am developing an MAC application in Snow Leopard.
I want to subclass NSButtonCell to get the desired look and feel. I found many sample projects which subclass NSButtonCell class (and over-ride required methods) and but they are linked to the button object on the app using Interface Builder. With this IB linking, all I need to do is implement methods like - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
and drawImage and the framework will take care of calling the methods.

In my case, I need to dynamically create NSButton object as the number of buttons that I need to create vary from time to time. Also I need to dynamically skin each button with an image file. How do I do this without using IB?

Regards,

Check the documentation for "initWithView" to create the button objects and "addSubview" to add them to a window.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.