• 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: "Default" Value In Object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Default" Value In Object


  • Subject: Re: "Default" Value In Object
  • From: Thaddeus Cooper <email@hidden>
  • Date: Sat, 18 Jun 2005 13:31:39 -0700

Per your suggestion, I implemented the new array controller, and in the debugger I can see the new newObject method being called -- only problem is -- controlTextDidEndEditing never seems to get called. Do I need to hook it up or should it just work? The documentation seems to suggest the latter, but...

--Thaddeus O. Cooper
(email@hidden)

On Jun 17, 2005, at 11:01 PM, mmalcolm crawford wrote:

To elaborate on the approach I suggested before, you could implement a newObject method in your array controller subclass that does something like:

- (id)newObject {
    NSManagedObect *newObject = (NSManagedObect *)[super newObject];

    [newObject setValue:lastSetValue forKey:@"keyName"];
    return newObject;
}

- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
    [self setLastSetValue:[[aNotification object] stringValue]];
}


- (NSString *)lastSetValue { return lastSetValue; } - (void)setLastSetValue:(NSString *)aLastSetValue { if (lastSetValue != aLastSetValue) { [lastSetValue release]; lastSetValue = [aLastSetValue copy]; } }


lastSetValue might be a local variable as suggested here, or you could store it in user defaults. You could also maintain it as document- or application-wide state, and add it to the metadata for the persistent store on save.


mmalc

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


This email sent to email@hidden


_______________________________________________ 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
References: 
 >"Default" Value In Object (From: Thaddeus Cooper <email@hidden>)
 >Re: "Default" Value In Object (From: mmalcolm crawford <email@hidden>)
 >Re: "Default" Value In Object (From: Thaddeus Cooper <email@hidden>)
 >Re: "Default" Value In Object (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: File system case sensitivity
  • Next by Date: Re: How to find an over-released object?
  • Previous by thread: Re: "Default" Value In Object
  • Next by thread: Re: "Default" Value In Object [SOLVED]
  • Index(es):
    • Date
    • Thread