• 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: Table of TextViews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Table of TextViews


  • Subject: Re: Table of TextViews
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 08 Oct 2014 21:18:29 -0500

On Oct 8, 2014, at 8:59 PM, Charles Jenkins <email@hidden> 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 (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:
    • Re: Table of TextViews
      • From: Charles Jenkins <email@hidden>
References: 
 >Table of TextViews (From: Charles Jenkins <email@hidden>)

  • Prev by Date: Table of TextViews
  • Next by Date: Concurrent tasks are getting hung up
  • Previous by thread: Table of TextViews
  • Next by thread: Re: Table of TextViews
  • Index(es):
    • Date
    • Thread