• 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
Changing NSTableView DataSource without glitching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing NSTableView DataSource without glitching


  • Subject: Changing NSTableView DataSource without glitching
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 15 Mar 2006 17:36:12 -0800
  • Thread-topic: Changing NSTableView DataSource without glitching

I use several NSTableView and NSOutlineView, and have found that crashes or
out-of-range exceptions occur sporadically if I change the data in the
DataSource while the table is being displayed; for example, if the
DataSource delegate methods read data from an NSArray instance variable, and
I do [setArray: newArray].

The solution I have found is to set the DataSource to nil, make my changes,
and then "reconnect" it and finally -reloadData...

[myTableView setDataSource:nil] ;
[self setArrayFromWhichDataIsTaken:newArray] ;
[myTableView setDataSource:self] ;
[myTableView setDelegate:self] ;
[myTableView reloadData] ;

This makes sense heuristically and has been proven experimentally and in the
field.  But can anyone explain this based on Cocoa documentation?

Jerry


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Changing NSTableView DataSource without glitching
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: Maximum simultaneous NSURLConnections?
  • Next by Date: Re: Changing NSTableView DataSource without glitching
  • Previous by thread: Re: developing on Intel based mac for ppc
  • Next by thread: Re: Changing NSTableView DataSource without glitching
  • Index(es):
    • Date
    • Thread