NSTableView - how to dynamically change the height of the elements?
NSTableView - how to dynamically change the height of the elements?
- Subject: NSTableView - how to dynamically change the height of the elements?
- From: Nick <email@hidden>
- Date: Wed, 14 Dec 2011 21:17:10 +0200
Hello
I have a table view, that displays the elements in a table view, each
row consists of an nsimagecell and an nstextfieldcell.
I want to let the user choose whether he sees the items big or small
in this list, i.e. whether each row is 40 px "tall", or 15 px.
I have implemented an NSTableView delegate's method:
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
if(iconsAreSmall) {
return 18;
} else {
return 35;
}
}
Where this iconsAreSmall is set to YES or NO, when the user clicks on
the corresponding radio button:
-(IBAction)radioGroupMatrixClicked:(id)sender {
iconsAreSmall = [sender selectedRow];
[tableView reloadData];
}
However, I am getting a weird behavior, the items are not displayed
smaller or larger, instead they just overlap, the image cell is not
being scaled normally.
I suppose, instead of calling [tableView reloadData] i need to direct
table view to relayout itself completely from scratch.
How can I do that?
I have tried -setNeedsLayout:YES and -setNeedsDisplay:YES, but with no effect...
Thank you
_______________________________________________
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