• 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: saveDocument newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saveDocument newbie question


  • Subject: Re: saveDocument newbie question
  • From: "Alan Smith" <email@hidden>
  • Date: Mon, 19 Jun 2006 13:03:31 -0400

Hmm. Well there are a couple of ways you could solve this.

1. Use a timer to check and see if the array has changed.

2. When the tableView is edited updateChangeCount

3. Receive notification when the user clicks on a row and then check the array.

I'd go with #3 because it would be the easiest to implement and
probably the most efficient. To get it working use some code like
this:

- (void)awakeFromNib
{
    [[NSNotificationCenter defaultCenter] addObserver: self

          selector: @selector(checkArray:)

              name: NSTableViewSelectionDidChangeNotification

             object: nil];
}
- (void)checkArray:(id)sender
{
    //check your array and updateChangeCount

    if (! [uneditedArray isEqualToArray: editedArray])
    {
         [self updateChangeCount: NSChangeDone];
         [uneditedArray release];
         uneditedArray = [[NSArray alloc] initWithArray: editedArray];
    }
}

To check your array you could keep two array objects. One would be the
one connected to your NSArrayController and the other is a duplicate
of the first. This way you just compare the two and you can do
whatever you want from there.

I hope all this gets you through your problem. Let me know if it works out.
Enjoy, Alan

--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
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: saveDocument newbie question
      • From: Neto <email@hidden>
References: 
 >Excluding native file type from saveDocumentTo: accessory view. (From: Joshua Scott Emmons <email@hidden>)
 >saveDocument newbie question (From: Neto <email@hidden>)
 >Re: saveDocument newbie question (From: Andrew Merenbach <email@hidden>)
 >Re: saveDocument newbie question (From: "Alan Smith" <email@hidden>)
 >Re: saveDocument newbie question (From: Neto <email@hidden>)

  • Prev by Date: Re: Stopping an NSRunLoop OR getting NSDistributedNotificationCenter notifications
  • Next by Date: Re: Stopping an NSRunLoop OR getting NSDistributedNotificationCenter notifications
  • Previous by thread: Re: saveDocument newbie question
  • Next by thread: Re: saveDocument newbie question
  • Index(es):
    • Date
    • Thread