What is the default font size of textLabel and detailTextLabel?
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):
UITableViewCellStyleSubtitle:
textLabel: Helvetica Bold, size: labelFontSize+1 (18 px)
detailsLabel: Helvetica, size: systemFontSize (14 px)
UITableViewCellStyleValue1:
textLabel: Helvetica Bold, size: labelFontSize (17 px)
detailsLabel: Helvetica Bold, size: systemFontSize+1 (15 px)
UITableViewCellStyleValue2:
textLabel: Helvetica Bold, size: smallSystemFontSize (12 px)
detailsLabel: Helvetica, size: labelFontSize (17 px)
The actual font size depends on the user's settings in Settings -> General -> TextSize. Normally, you shouldn't use a fixed font size, but should use something like:
[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]
obviously depending on what you need. Anyway, if you create a UITableViewCell
with style UITableViewCellStyleSubtitle
, then the font of cell.text is the same object as
[UIFont preferredFontForTextStyle: UIFontTextStyleBody]
and the font of cell.detailTextLabel is the same object as
[UIFont preferredFontForTextStyle: UIFontTextStyleCaption1].
You get fonts from largest to smallest using the constants ending in "Body", "Subheadline", "Footnote", "Caption1", "Caption2" so you know what to use if you want slightly smaller or bigger text. "Headline" is same size as "Body" but bold.
It's probably best to just create a cell at runtime and get the fonts from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With