Re: insert a plist in a NSTableView using a NSDictionary
Re: insert a plist in a NSTableView using a NSDictionary
- Subject: Re: insert a plist in a NSTableView using a NSDictionary
- From: deepak gopal <email@hidden>
- Date: Sun, 23 Sep 2007 21:54:49 +0100 (BST)
I need to load the contents of a plist onto the
NSTableView.
I thought it would be easy to make a dictionary of the
contents of plist and load it onto the tableView.
So I wrote :
plistDictionary_ = [NSDictionary
dictionaryWithContentsOfFile:kPlistPath];
Now the NSTableView delegate methods in the datasource
want me to return the value I need to load in the
Table. I need to load the plist key and the value in
the same row of the tableView. How will I do that? I
think I can achieve that by giving the correct return
value for the delegate method:
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn
*)tableColumn
row:(int)row {
return [plistDictionary_ objectForKey:[dictArray_
objectAtIndex:row]] ;
}
So the question is:
What should be the return value for this method?
I have a NSDictionary with all the contents of plist
in the format: Key = "value"
DG
--- Shawn Erickson <email@hidden> wrote:
>
> On Sep 23, 2007, at 12:17 PM, deepak gopal wrote:
>
> > Hi
> >
> > I am trying to insert a plist on to a NSTableView.
> So
> > I have two columns in tableView, one for Key and
> the
> > other for Value.
> >
> > plistDictionary_ = [NSDictionary
> > dictionaryWithContentsOfFile:kPlistPath];
> >
> > How will I load this NSDictionary onto the
> > NSTableView?
> >
> > What should be the return value in
> >
> > - (id)tableView:(NSTableView *)tableView
> > objectValueForTableColumn:(NSTableColumn
> > *)tableColumn
> > row:(int)row {
>
> You return the data you want to display in the
> table. You can return
> NSStrings and they will be displayed. You can return
> other types of
> objects as well however those may require special
> NSCell subclasses
> or formatters to be used to display correctly.
>
> We will need more information to fully outline how
> to do this.
>
> -Shawn
> _______________________________________________
>
> 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
>
Bring your gang together - do your thing. Go to http://in.promos.yahoo.com/groups
_______________________________________________
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