• 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: Noobie Question: NSTableView and XML-RPC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Noobie Question: NSTableView and XML-RPC


  • Subject: Re: Noobie Question: NSTableView and XML-RPC
  • From: "Kyle Sluder" <email@hidden>
  • Date: Wed, 19 Nov 2008 04:13:12 -0500

On Tue, Nov 18, 2008 at 1:42 PM, Kennard Smith <email@hidden> wrote:
> I'd imagine just setting a dataSource then querying the XML-RPC server for
> data when tableView:objectValueForTableColumn:row: is called.

The documentation tells you this is a very bad idea:

"Note:  tableView:objectValueForTableColumn:row: is called each time
the table cell needs to be redisplayed, so it must be efficient."

So don't do network round-trips in this method.  Get the data first
and cache it.

> Another curiosity I had was when or does the NSTableView reload its data?

The NSTableView knows nothing about its data[1].  That's why
-tableView:objectValueForTableColumn:row is called so frequently.

It really helps if you look at NSTableView as just a very clever
illusion.  When parts of the table need to be drawn, NSTableView
figures out what rows are in that dirty rectangle and then asks the
data source for the data for those rows.

>  Do I have to tell it to reload periodically?

The logical continuation of what I wrote above means "yes."  If the
contents of a row that's currently displayed on screen change, but
NSTableView only asks for data when it needs to redraw, then you'll
need to tell it to redraw the affected regions; that's what the
-reloadData and related methods are all about.

Likewise, once a portion of the table has been drawn, the table view's
enclosing NSScrollView (actually its NSClipView) can just copy the
drawn regions around as the table is scrolled.  This means that once a
row has been drawn, simply scrolling it off screen and then back on
isn't going to cause it to appear updated.

[1] Actually, I have been informed in the past that NSTableView does
cache certain details about the data, but what, if anything, it caches
is irrelevant.  It might just be the bare minimum so that it sets its
frame and bounds correctly, or it might be more.

--Kyle Sluder
_______________________________________________

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: 
 >Noobie Question: NSTableView and XML-RPC (From: Kennard Smith <email@hidden>)

  • Prev by Date: Re: Binding a CoreData string value to an NSTextView
  • Next by Date: Re: Window title bar accessory view
  • Previous by thread: Noobie Question: NSTableView and XML-RPC
  • Next by thread: Passing TableView information into a new dialog
  • Index(es):
    • Date
    • Thread