Re: Output of NSHTTPCookieStorage to NSTableView
Re: Output of NSHTTPCookieStorage to NSTableView
- Subject: Re: Output of NSHTTPCookieStorage to NSTableView
- From: Chris Purcell <email@hidden>
- Date: Sun, 29 Jun 2008 09:39:57 -0700
Thank you for the reply. I think right now the simplest would be to
convert the cookies array to an array of NSStrings. What would be the
easiest way to do this?
Thank you!
On Jun 28, 2008, at 9:56 PM, Shawn Erickson wrote:
On Sat, Jun 28, 2008 at 9:46 PM, Chris Purcell <email@hidden
> wrote:
Hello,
Not sure where my problem is I've tried a few things and no
success. I am
trying to output NSHTTPCookieStorage *cookies array to a table view.
Whenever I call the objectValueForTableColumn:row method the app
errors
out, but if I leave it out the app launches displaying the correct
number of
rows with nothing in it (as expected since I left out the other
method).
Here is the code to get the cookies array:
NSHTTPCookieStorage* sharedCookieStorage = [NSHTTPCookieStorage
sharedHTTPCookieStorage];
cookies = [sharedCookieStorage cookies] ;
Here is the code to output the data to the table view:
- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
return [cookies count];
}
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
return [cookies objectAtIndex:row];
}
What type of NSCell do you have set for the column (looks like you
only have a single column)? It is a specialized NSCell subclass that
knows how to display an instance NSHTTPCookie? If not this isn't going
to work as coded.
NSHTTPCookie isn't a string, number, image, etc. so one of the
standard cell subclasses wont know what to do with it. You either need
a custom cell subclass that can display it the way you want it
displayed or you will have to convert the NSHTTPCookie instance into a
form that a standard cell can handle (maybe an NSString).
-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