Re: dynamically create/remove IB elements and instance vars?
Re: dynamically create/remove IB elements and instance vars?
- Subject: Re: dynamically create/remove IB elements and instance vars?
- From: Quincey Morris <email@hidden>
- Date: Thu, 10 Dec 2009 15:35:50 -0800
On Dec 10, 2009, at 14:21, Patrick J. Collins wrote:
> I would like to expand on this and make it a little more interesting and
> challenging, but I don't know how to do what I am thinking-- which is:
>
> Create a button which will insert a new label/text field. This action also
> needs to dynamically generate an instance variable in my model file for the
> text of the new textfield, as well as generate an IBOutlet in my controller.
But why? In the exact terms you've used, this is not a pattern you're likely to use in any practical application. Although Objective-C is in many senses a dynamic language, this particular kind of dynamism is not usual in most applications.
If there's only one "new" label, then you might as well go ahead and design it into your code and your interface to begin with (even if it's hidden initially). If there might be an arbitrary number of new labels to show in the interface, you might use an NSArray or NSDictionary instance variable to hold the values, and a NSTableView to display them.
_______________________________________________
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