On Oct 8, 2014, at 8:59 PM, Charles Jenkins <cejw...@gmail.com> wrote:

> Now I try to bind the table. I select the Table View object and bind Table 
> Content to the array controller’s arrangedObjects myView key path. Then I 
> bind its Row Height to the array controller’s arrangedObjects myHeight key 
> path.
> 
> The next time I run the program, no document ever appears. Initialization 
> happens normally, but before the window opens, an error is logged: 
> [__NSArrayI doubleValue]: unrecognized selector sent to instance <address>.

> What if anything am I doing wrong when I try to bind the row height? Adding 
> that one thing causes the error and interrupts the NIB from loading.

The table view's rowHeight binding is not a per-row row height.  It's a single 
number for the height of all rows of the table.

Using KVC to get the value from the array controller with the key path 
"arrangedObjects.myHeight" returns an array.  -valueForKey: applied to an array 
will always produce an array, and -valueForKeyPath: is just a series of 
-valueForKey: calls.  Then, the table view calls -doubleValue on whatever 
object KVC obtained.  Hence the error that an array class doesn't respond to 
-doubleValue.

If you want separate row heights for each row, you need to implement a table 
view delegate and the method -tableView:heightOfRow:.  You would look up the 
object for the row by indexing into the array controller's arrangedObjects and 
obtain the height from your myHeight property.

If/when you change the height of a subdocument, you need to inform the table 
view by calling -noteHeightOfRowsWithIndexesChanged: on it.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to