Re: editing in a custom NSView
Re: editing in a custom NSView
- Subject: Re: editing in a custom NSView
- From: Mike Manzano <email@hidden>
- Date: Fri, 18 Apr 2008 17:01:40 -0700
NSTableView:
tableView:heightOfRow:
Returns the height of row in tableView.
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
Discussion
You should implement this method if your table supports varying row
heights. The height returned should not include intercell spacing and
must be greater than zero.
Although table views may cache the returned values, you should ensure
that this method is efficient. When you change a row's height you must
invalidate the existing row height by calling
noteHeightOfRowsWithIndexesChanged:. NSTableView automatically
invalidates its entire row height cache when reloadData and
noteNumberOfRowsChanged are called.
Availability
Available in Mac OS X v10.4 and later.
Declared In
NSTableView.h
On Apr 18, 2008, at 4:32 PM, Torsten Curdt wrote:
Hey guys,
I need some pointers into the right direction.
I would like to create a view that display a list of objects with
their attributes. Of course NSTableView could do that. But I would
like the rows to expand vertically when I add more information to
the object ...and have the attributes not just layed out in column
based manner. The most simple example: a list of multi line edit
fields. Example: OmniOutliner - press alt-enter and the line height
increases. AFAIK you cannot do that with either NSTableView or
NSCollectionView as the row heights may be different per row.
So I already got a custom view that is manually bound to
NSArrayController and draws the objects. Now I need to make one of
the object's string attributes editable. How to do that best?
I assume I could catch the click on the item, then (somehow) show in
place a NSTextView and have the user do the changes to the text. On
every change I would check the height of the NSTextView and apply
that to the drawing of the item. Once done I'll hide the NSTextView
again. Does that sound like reasonable approach? Or how would you
tackle this?
Any suggested example or open source project to look at?
cheers
--
Torsten
______________
_______________________________________________
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