Easy. Create an instance of a NSButton:
NSButton *myButton = [[NSButton alloc] initWithFrame:nsRectOfButton];

Then add it to your view:
[view addSubview:myButton];

of course you might want to edit the image, title, style of the button, so check in NSControl and NSButton docs for the configuration methods.

As for in iPhoto, if you mean the list of all the albums, those aren't buttons. Take a look at the NSTableView docs or one of it's subclasses to set up that sort of list.

To make it short, you need to set up a NSTableView in IB, then set it's dataSource outlet to one of your controller classes, and implement certain methods in that class to supply the table view with content.

On Mar 1, 2008, at 12:49 PM, Thiago Rossi wrote:

Does anyone know how to add buttons dynamically? For example, on iPhoto there are albuns on the left bar. I think they are buttons. What are them
and how can I add it dynamically?

--
定魅刀利
Dimitri Bouniol
[EMAIL PROTECTED]
http://web.mac.com/dimitri008/



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to