Refreshing an NSTableView with an NSMutableArray dataSource

  • I know this is a horrible newbie question but I am hoping that someone
    can simply confirm that I'm not missing something. Am I correct in
    assuming that the only way to reflect changes made to an
    NSMutableArray in an NSTableView which is using the array as a
    dataSource is by using reloadData?

    Please note that this is all being done via delegates and not by
    Bindings and I am doing the challenge at the end of chapter 6 of
    Aaron's book (3rd edition).

    Many thanks.

    Simon
  • On Mon, May 26, 2008 at 7:30 PM, Simon Wolf <swolf...> wrote:

    > I know this is a horrible newbie question but I am hoping that someone can
    > simply confirm that I'm not missing something. Am I correct in assuming that
    > the only way to reflect changes made to an NSMutableArray in an NSTableView
    > which is using the array as a dataSource is by using reloadData?

    Yes. But here's what you may be missing: the NSTableView is not using
    the NSMutableArray as a datasource. It is using a controller object
    that happens to be quizzing an NSMutableArray to provide its answers,
    but could just as well be quizzing a database or a web service.

    Hamish
  • On 26 May 2008, at 19:52, Hamish Allan wrote:

    > On Mon, May 26, 2008 at 7:30 PM, Simon Wolf <swolf...>
    > wrote:
    >
    >> I know this is a horrible newbie question but I am hoping that
    >> someone can
    >> simply confirm that I'm not missing something. Am I correct in
    >> assuming that
    >> the only way to reflect changes made to an NSMutableArray in an
    >> NSTableView
    >> which is using the array as a dataSource is by using reloadData?
    >
    > Yes. But here's what you may be missing: the NSTableView is not using
    > the NSMutableArray as a datasource. It is using a controller object
    > that happens to be quizzing an NSMutableArray to provide its answers,
    > but could just as well be quizzing a database or a web service.

    Thanks Hamish. I did miss that the whole controller object is the
    dataSource rather than just the NSMutableArray but it is stupidly
    obvious once I look at my code again.

    Simon
previous month may 2008 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Go to today