Skip navigation.
 
mlRe: Adding GUI components dynamically
FROM : Dimitri Bouniol
DATE : Sat Mar 01 23:07:00 2008

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_removed>
http://web.mac.com/dimitri008/

Related mailsAuthorDate
mlAdding GUI components dynamically Thiago Rossi Mar 1, 21:49
mlRe: Adding GUI components dynamically Dimitri Bouniol Mar 1, 23:07
mlRe: Adding GUI components dynamically Thiago Rossi Mar 2, 04:18
mlRe: Adding GUI components dynamically Jens Alfke Mar 3, 22:53