• 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: KVC not allowing setValue:forKey: on ints [Solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC not allowing setValue:forKey: on ints [Solved]


  • Subject: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • From: Guy English <email@hidden>
  • Date: Mon, 2 Apr 2007 01:56:48 -0400

- (void) setValue: (id) value forKey: (NSString*) key; takes an object for it's first param. The documentation is referring to the fact that you can *bind* that key to the intValue of some other object. But the automatic wrapping won't take place when you're calling it directly as you are in this code.
Thanks Guy, Hal and Chris.

Ken
Hope that helps,
Guu

Pleasure. But for the archives 'Guu' isn't my real name. :)

The 'magic' that's happening is that when you bind what's basically happening is that one object asks the other for it's valueForKey:. The signature for valueForKey is: - (id) valueForKey: (NSString*) key. So:

[self setValue: [otherObject valueForKey: "bobo"] forKey: @"bobo"];

works because the valueForKey call has wrapped the value for it. Now I say "basically" because that's what's happening *conceptually* in reality the value is given to the observe key path method. But the params to that are passed in a dictionary and as such are also pre- wrapped for you.

Later,
Guy

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: KVC not allowing setValue:forKey: on ints [Solved]
      • From: Ken Tozier <email@hidden>
References: 
 >KVC not allowing setValue:forKey: on ints (From: Ken Tozier <email@hidden>)
 >Re: KVC not allowing setValue:forKey: on ints (From: Guy English <email@hidden>)
 >Re: KVC not allowing setValue:forKey: on ints [Solved] (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Next by Date: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Previous by thread: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Next by thread: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Index(es):
    • Date
    • Thread