multiple lines in NSTableView

  • Hello,

    I'm implementing a CoraData app with NSTableView. one of my string
    fields can contain multiple lines. I bind the entity through a
    ArrayController to the NSTableView. How can I display multiple lines
    in one row? Can NSTableView assign row height for each row depending
    on line count for the entity field individually?

    Thanks,
    Ferhat
  • On Dec 31, 2006, at 12:17 AM, Ferhat Ayaz wrote:

    > Can NSTableView assign row height for each row depending on line
    > count for the entity field individually?

    It won't do it automatically, but you could do it in the delegate by
    implementing:

    - (float)tableView:(NSTableView *)tableView heightOfRow:(int)row;

    Inside that method you would use the NSArrayController's -
    arrangedObjects array and get the item at the index of 'row'. If has
    two lines, you can return double the normal line height (maybe 36.0,
    for example).

    This only works in 10.4 and later. If you need it to work on an
    earlier version there's a third party class out there somewhere that
    does something similar (though I'm not sure it's still maintained).

        - Scott
  • > This only works in 10.4 and later. If you need it to work on an
    > earlier version there's a third party class out there somewhere that
    > does something similar (though I'm not sure it's still maintained).

    Development has been "quiet" for a while, but I recently used it very
    successfully. (And intend to submit my own improvements RSN.)

    <http://evanjones.ca/software/osx-tableview.html>

    --
    Scott Ribe
    <scott_ribe...>
    http://www.killerbytes.com/
    (303) 722-0567 voice
    Ferhat Ayaz <ferhat.ayaz...>
previous month december 2006 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Go to today