Thank you for responding, guys.
Keary, I see you’re right: NSTableViewDelegate’s tableView:heightOfRow: will be
key if my stack of editors appears in a table view. I’ve been struggling all
day to get a test program to call my delegate’s functions. I must say, the
table view is a very disheartening object to work with.
John, I am sort of doing a master-detail type of thing. I’m trying to implement
my own version of Jer’s Novel Writer. On the left side of the screen, there’ll
be an Outline View of a novel’s structure, with chapters and scenes. On the
right, a stack of text views. If a single scene is selected in the outline,
then the stack will contain one editor. But if a chapter is selected, then
there’ll be one editor for each scene within it. (Each scene is stored in a
separate RTF file in the document’s package file.) I think my stack can be as
large as needed without regard to the window’s height: the whole thing will be
contained within a scroll view.
I tried working with the NSStackView yesterday, and it would only overlay my
subviews on top of one another, rather then presenting them in a vertical
column as expected. I created 16 variously sized NSBox objects and used a loop
to add each one to the top gravity of the stack view. Because the boxes were
different sizes, I could see that they were laid uselessly on top of one
another like cards in a deck.
Today I’m using the same array of NSBoxes, but trying to put them into a
single-column table. My table-manager class acts as both a data source and
delegate, and because of breakpoints I know that my data source methods are
called as expected, as well as some delegate ones, but the methods important to
my needs are never called. The table view is set up as view-based in IB and
does not have a fixed row size. However, tableView:viewForColumn:row and
tableView:heightOfRow: are never called.
I’ve struggled with these all day and still can’t figure out why the methods
that matter don’t get called. I copied the prototypes directly from the
NSTableView documentation and only renamed some variables. I’ve checked several
times that the table is configured to be view-based and has no fixed row size.
Assuming I’ve got the prototypes right, can anyone suggest reasons why the
table would call some delegate methods, but not the important ones shown below?
//==============================
// NSTableViewDelegate methods
//------------------------------
// Return view for row
- (NSView*) tableView:(NSTableView*)tv
viewForTableColumn:(NSTableColumn*)tc
row:(NSInteger)row
{
return [self viewForRow:row];
}
// Return height of row
- (CGFloat)tableView:(NSTableView*)tv
heightOfRow:(NSInteger)row
{
return [self viewForRow:row].frame.size.height;
}
—
Charles Jenkins
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]