본문 바로가기

iPhone dev./UIView, UITableView

TableViewCell Default Font

Anybody knows the default font size of UITableViewCell?

link|improve this question

53% accept rate
Why is this being downvoted? Sure, there's "RTFM", but it is a legitimate question. The OP didn't mention where/how he/she looked, I guess that's what I'd say is wrong with it. – makdad Feb 8 '11 at 1:11
feedback

3 Answers

[UIFont boldSystemFontOfSize:17.0];

Which was discovered by changing the font of a UITableViewCell's textLabel until it matched the default.

link|improve this answer
2  
Actually, i found it to be size 18... – Chris Aug 12 '11 at 12:00
feedback

This question was answered here by Vladimir.

Here's what he said:

You can always set any font to those labels in code so if you want some guaranteed fixed values you'd better do that as size values may vary depending on many factors (cell's style, sdk version, os version etc).

I've tested on simulator with 4.2 SDK version and got following results (no extra properties were set for cells):

  1. UITableViewCellStyleSubtitle:

    textLabel: Helvetica Bold, size: labelFontSize+1 (18 px)

    detailsLabel: Helvetica, size: systemFontSize (14 px)

  2. UITableViewCellStyleValue1:

    textLabel: Helvetica Bold, size: labelFontSize (17 px)

    detailsLabel: Helvetica Bold, size: systemFontSize+1 (15 px)

  3. UITableViewCellStyleValue2:

    textLabel: Helvetica Bold, size: smallSystemFontSize (12 px)

    detailsLabel: Helvetica, size: labelFontSize (17 px)

UITableViewCellStyleSubtitle font size

link|improve this answer
Was this post useful to you?     

If you look in the documentation for UIFont there are methods for retrieving system font sizes. I'd say they'll have you're answer.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIFont_Class/Reference/Reference.html

+ labelFontSize is probably the one you're after.

link|improve this answer
feedback