• 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: Output of NSHTTPCookieStorage to NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Output of NSHTTPCookieStorage to NSTableView


  • Subject: Re: Output of NSHTTPCookieStorage to NSTableView
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 29 Jun 2008 23:31:05 -0700


On 29 Jun '08, at 9:47 PM, Chris Purcell wrote:

Thank you for the reply. I am a bit of a Cocoa newbie and I'm having trouble using the objectValueForTableColumn:. My NSTableView is only one column, but I would like to display all attributes of each key.

You should have one column per attribute. If you look at any typical table display (in Mail, or the Finder, or iTunes...) you'll see that each column shows one attribute of the message/file/song.


This is an example of what is outputting when I display a entry of the NSArray:
<NSHTTPCookie version:0 name:@"SC" value:@"RV=661339" expiresDate:@"2038-01-17 11:14:07 -0800" created:@"236061243.432815" sessionOnly:FALSE domain:@".google.com" path:@"/finance" secure:FALSE comment:@"(null)" commentURL:@"(null)" portList:(null)>
Is this a dictionary?

No, that's just the string that an NSHTTPCookie object returns from its -description method.


What would be the easiest way to display each one of the attributes of the dictionary (version, name, value, etc.) in a separate column? How could I return just one of the attributes?

If you just want to display the domain, then return [cookie domain]. If you want to return the path, return [cookie path]. Et cetera.


A common trick is to set the "identifier" property of each table column (in IB) to be a property name. Then your - objectValueForTableColumn method can get the object for the row and call -valueForKey: on it, using the column identifier, like:

NSHTTPCookie *cookie = [_cookies objectAtIndex: row];
NSString *identifier = [column identifier];
return [cookie valueForKey: identifier];

—Jens_______________________________________________

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


References: 
 >Output of NSHTTPCookieStorage to NSTableView (From: Chris Purcell <email@hidden>)
 >Re: Output of NSHTTPCookieStorage to NSTableView (From: "Shawn Erickson" <email@hidden>)
 >Re: Output of NSHTTPCookieStorage to NSTableView (From: Chris Purcell <email@hidden>)
 >Re: Output of NSHTTPCookieStorage to NSTableView (From: Jens Alfke <email@hidden>)
 >Re: Output of NSHTTPCookieStorage to NSTableView (From: Chris Purcell <email@hidden>)

  • Prev by Date: [MEET] CocoaHeads Mac Developer Meetings
  • Next by Date: Re: Layer Backed Views and CoreAnimation neither animate nor stay in place
  • Previous by thread: Re: Output of NSHTTPCookieStorage to NSTableView
  • Next by thread: XML-RPC Cocoa Parsing
  • Index(es):
    • Date
    • Thread