• 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
NSTableView - how to dynamically change the height of the elements?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTableView - how to dynamically change the height of the elements?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: predicates and sort descriptors for NSFetchRequest - documentation is a bit vague
  • Next by Date: Re: NSTableView - how to dynamically change the height of the elements?
  • Previous by thread: Re: predicates and sort descriptors for NSFetchRequest - documentation is a bit vague
  • Next by thread: Re: NSTableView - how to dynamically change the height of the elements?
  • Index(es):
    • Date
    • Thread