Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method)
Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method)
- Subject: Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method)
- From: Max Barel <email@hidden>
- Date: Tue, 5 Oct 2004 15:54:59 +0200
Le 5 oct. 04, à 06:44, Scott Anguish a écrit :
Le 2 oct. 04, à 23:44, Scott Anguish a écrit :
On Oct 2, 2004, at 7:57 AM, Max Barel wrote:
I'm aware of what can be done with categories and -more binding
specific- with value transformers.
What is still unclear for me is: What is a valid accessor for a
framework object?
any method in for form
-(returnsomevalue)theAccessor
can be called using KVC.
The NSDictionary interface does not show any public ivar. Does this
means that it has NO KVC property?
Or else, are parameterless methods valid accessors to the object
information?
as long as they return a value, yes.
Thanks. That's precisely the info I was seeking for.
If yes, why another method returning an NSString does not work
neither :
- (NSString *)descriptionInStringsFileFormat;
that I didn't know about.. what does it print?
The [anNSDictionary description] method returns:
{
NSDeviceBitsPerSample = 8;
NSDeviceColorSpaceName = NSCalibratedRGBColorSpace;
NSDeviceIsScreen = YES;
NSDeviceResolution = <42900000 42900000 >;
NSDeviceSize = <44a00000 44558000 >;
NSScreenNumber = 69666816;
}
The [anNSDictionary descriptionInStringsFileFormat] method returns:
"NSDeviceSize" = <44a00000 44558000 >;
"NSDeviceColorSpaceName" = "NSCalibratedRGBColorSpace";
"NSDeviceResolution" = <42900000 42900000 >;
"NSDeviceBitsPerSample" = 8;
"NSScreenNumber" = 69666816;
"NSDeviceIsScreen" = "YES";
Both work as expected when called "normally" and the result is assigned
to the TextView with Outlet scheme.
Neither work when accessed using binding/KVC.
In a more general description:
- The NSArraycontroller manage an array of NSScreen (tried both NSArray
and mutable copy).
- Its object class is defined as NSScreen.
- NSScreen objects have a property named deviceDescription, of class
NSDictionary.
No accessor of the form selection.deviceDescription.amethod[an
NSArraycontroller] works.
Accessors of the form selection.deviceDescription.aKey (e.g
selection.deviceDescription.NSDeviceSize) work once. Changing the
initial selection crash on signal 10.
Can we suspect a weird behavior with NSDictionary to-one relationship?
Anyway this is not the main point. As soon as you know a bug, it can be
avoided. You just have to know it.
The truly clarifying point is the clear definition of what can be a KVC
accessor.
_______________________________________________
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