• 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
KVO Question -- Really Simple for Pros
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO Question -- Really Simple for Pros


  • Subject: KVO Question -- Really Simple for Pros
  • From: "Alex Wait" <email@hidden>
  • Date: Fri, 27 Jun 2008 22:20:19 -0700

Practicing some KVO concepts.

I have this line

    [person addObserver:textField forKeyPath:@"firstName"
options:NSKeyValueObservingOptionNew context:NULL];


person is App Controller's Person object.
textField is a NSTextField
person does have a "firstName" property of type NSString

When I click on a button that updates the firstName property I get this
message

2008-06-27 22:17:29.751 Bindings1[21896:10b] <NSTextField: 0x123c30>: An
-observeValueForKeyPath:ofObject:change:context: message was received but
not handled.
Key path: firstName
Observed object: firstName: Basic and lastName: Wait
Change: {
    kind = 1;
    new = Basic;
}
Context: 0x0


At least it's firing! ^_^
But I was sure since I have a firstName method and a setFirstName method it
would update the textField. I have used IB to bind the value of the
textField to the value of the person object and that works when I edit the
textfield (yay). So I know I have the proper methods. I think.

Am I doing something wrong? (I assume I am)

--
If you can't be kind, at least have the decency to be vague.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: KVO Question -- Really Simple for Pros
      • From: "Owen Yamauchi" <email@hidden>
    • Re: KVO Question -- Really Simple for Pros
      • From: mmalc crawford <email@hidden>
  • Prev by Date: Re: Style Question
  • Next by Date: Re: KVO Question -- Really Simple for Pros
  • Previous by thread: Re: Style Question
  • Next by thread: Re: KVO Question -- Really Simple for Pros
  • Index(es):
    • Date
    • Thread