• 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
Re: NSString sizeWithAttributes inaccuracy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString sizeWithAttributes inaccuracy


  • Subject: Re: NSString sizeWithAttributes inaccuracy
  • From: Jacob Ole Juul Kolding <email@hidden>
  • Date: Fri, 25 Jul 2008 11:52:19 +0200

It's more than one pixel.
First time i noticed it was with a string of about 140 chars which gut truncated about 10 chars.


Jacob Kolding
email@hidden


On Jul 25, 2008, at 11:19 AM, Manfred Schwind wrote:

he problem is that on very large strings sizeWithAttributes comes up short [no pun intended]

How much too short? Is it less than 1 pixel?

			float tiw = [self stringPixelWidth:[records objectAtIndex:i]];
			if(tiw > maxWidth){
				maxWidth = tiw;
			}
[...]
		[[[myTableView tableColumns] objectAtIndex:0] setWidth:maxWidth];

I think table columns are expected to have integer widths, so you have to round up to the next integer, e.g. like that:


[[[myTableView tableColumns] objectAtIndex:0] setWidth:ceilf(maxWidth)];

Mani
--
http://mani.de - friendly software
iVolume - listen to music freehand
LittleSecrets - the encrypted notepad




_______________________________________________

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


References: 
 >NSString sizeWithAttributes inaccuracy (From: Jacob Ole Juul Kolding <email@hidden>)
 >Re: NSString sizeWithAttributes inaccuracy (From: Manfred Schwind <email@hidden>)

  • Prev by Date: NSCollectionView
  • Next by Date: Re: NSString sizeWithAttributes inaccuracy
  • Previous by thread: Re: NSString sizeWithAttributes inaccuracy
  • Next by thread: NSTableview datasource and NSPopupButtonCell
  • Index(es):
    • Date
    • Thread