Is there a way to get the measurements of \t in an NSString?

If this is a repeat, let me know and I'll remove it immediately--I've had the devil of a time searching for the answer, since "\t" returns searches without the forward slash.

I need to find the width of an NSString that contains begins with \t\t . Using sizeWithFont doesn't do it, since it just ignores the space. Is there a way to measure how much space the tab takes up?

Answers


Not sure what your code was but this seemed to work for me.

NSString *delMessage = @"\t";
CGSize theSize = [delMessage sizeWithFont:[UIFont fontWithName:@"American Typewriter" size:30]];
NSLog(@"length %f",theSize.width);

log was length 8.000000

NSString *delMessage = @"\t\t";
CGSize theSize = [delMessage sizeWithFont:[UIFont fontWithName:@"American Typewriter" size:30]];
NSLog(@"length %f",theSize.width);

log was length 16.000000


Need Your Help

EJB Overriding JPA javax.persistence

java hibernate jpa ejb guice-persist

I'm fairly new to the Java EE space, so pardon my ignorance here; I inherited an application which is using guice-persist and hibernate to handle the ORM.

TCPDF - Special characters(like this: • ) showing up as diamond question mark

php pdf utf-8 fonts tcpdf

I know that TCPDF supports special characters and multiple languages. I have tried all the provided fonts. I want to generate the PDF in UTF-8. I know that the included font 'freeserif' for sure

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.