• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding GUI components dynamically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding GUI components dynamically


  • Subject: Re: Adding GUI components dynamically
  • From: Dimitri Bouniol <email@hidden>
  • Date: Sat, 1 Mar 2008 14:07:00 -0800

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



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Adding GUI components dynamically
      • From: Jens Alfke <email@hidden>
    • Re: Adding GUI components dynamically
      • From: "Thiago Rossi" <email@hidden>
References: 
 >Adding GUI components dynamically (From: "Thiago Rossi" <email@hidden>)

  • Prev by Date: Adding GUI components dynamically
  • Next by Date: Unread count for items in Mail.app-styled NSOutlineView
  • Previous by thread: Adding GUI components dynamically
  • Next by thread: Re: Adding GUI components dynamically
  • Index(es):
    • Date
    • Thread