Re: saveDocument newbie question
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