Haagenti
Haagenti

Reputation: 8154

iOS KVO superclass

I'm trying through KVO reach a superclass and then a object which has a property. It looks likes this

SuperCell(UITableViewCell) - Person * - name(NSString*)

/\

Cell(SuperCell)

It keeps crashing when I do this:

[cell valueForKey:@"person.name"];

But when I do this it works:

[[cell valueForKey:@"person"] valueForKey:@"name"];

Is it possible to do the first style? Or do I need to split it myself?

Upvotes: 0

Views: 103

Answers (1)

John Estropia
John Estropia

Reputation: 17500

Use valueForKeyPath: instead.

[cell valueForKeyPath:@"person.name"];

Upvotes: 1

Related Questions