How do you know how much space an NSString (using default font) will occupy on a UITableView section

Posted by paul_sns on Stack Overflow See other posts from Stack Overflow or by paul_sns
Published on 2010-03-29T12:20:56Z Indexed on 2010/03/29 12:23 UTC
Read the original article Hit count: 145

Basically I want to copy the behavior in iPhone's Calendar where the day of week (Mon, Tue, Wed) is on the left side of the table's section header (left justified) while the formatted date (Apr 1, 2010, May 1, 2010) based on locale is on the right side of the table's section header (right justified).

I was thinking of inserting a variable amount of space in between the day of week and formatted date but I first need to know the actual space consumed by the text on both sides to figure out how much space to add.

Hope to hear your thoughts on this.

Thanks.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about nsstring