Re: Bindings Help
Re: Bindings Help
- Subject: Re: Bindings Help
- From: Quincey Morris <email@hidden>
- Date: Tue, 23 Sep 2008 11:21:34 -0700
On Sep 23, 2008, at 10:22, Eric Lee wrote:
Using bindings, how do you add an object (a textfield's string to be
specific) to a NSMutableArray so that a table view can show the
object?
You need to modify the array in a KVO-compliant manner, which means
the array needs to be a property of some object in your data model.
Then use:
[[myDataModelObject mutableArrayValueForKey: @"myArray"] addObject:
newString];
In the simplest case, the array can just be an instance variable of
the data model object, since KVC is capable of finding instance
variables directly:
@interface MyDataModel ... {
NSMutableArray* myArray;
...
}
Or it can be a genuine property:
@interface MyDataModel ... {
...
}
@property (...) NSArray* myArray;
with a suitable implementation in MyDataModel.
_______________________________________________
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