• 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: Can a model key path binding access a super class property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a model key path binding access a super class property


  • Subject: Re: Can a model key path binding access a super class property
  • From: James Bucanek <email@hidden>
  • Date: Sun, 17 Jan 2010 10:04:59 -0700

Grant Christensen <mailto:email@hidden> wrote (Sunday, January 17, 2010 6:53 AM +1000):

In my window I have a NSTableView that is using an array controller to get
access to my data.  The array controller is bound to an array of
BBSMoreSpecific classes.

The problem I am having is that all of my columns bound to the fields in the
BBSMoreSpecific class show their data, but those bound to those in the base
class do not.  I am using a simple model key path of just the name of the
ivar, so aValue and anotherValue.

Can the bindings access the base class or can they only access values in the
class the array controller is directly connected to?

Of course you can. This is a basic principle of object oriented languages (unless there's scoping, but Objective-C doesn't support that). You could verify this by using a key-value path to access any of the object's NSObject properties, like -description.


I suspect that something else is wrong. Your simplistic example appears to be valid, but it's obviously not the code you're using. It time to hit the debugger....

Since you've declared these as formal properties, KVO should be accessing these properties via their accessor methods. One trick is to override the base-class getter method in your subclass like this:

@implementation BBSMoreSpecific
...
- (NSString*)aValue
{
    NSString* value = [super aValue];
    //NSLog(@"%s returning '%@'",__func__,value);
    return value;   // <-- set breakpoint here
}

Now you can set a breakpoint or log every access to that property. You shouldn't have any problem verifying if the correct messages are being sent (or not), by whom, and then work backwards from there.

--
James Bucanek

_______________________________________________

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:
    • [SOLVED]: Re: Can a model key path binding access a super class property
      • From: Grant Christensen <email@hidden>
References: 
 >Can a model key path binding access a super class property (From: Grant Christensen <email@hidden>)

  • Prev by Date: Re: NSTextField sendActionOn:
  • Next by Date: Re: Bindings Problem
  • Previous by thread: Can a model key path binding access a super class property
  • Next by thread: [SOLVED]: Re: Can a model key path binding access a super class property
  • Index(es):
    • Date
    • Thread