What are the default font settings used in UITableViewCell styles?

Does anyone have a list of default font settings that Apple uses in UITableViewCells, UILabel, etc.? Also, positioning information for textLabel in a UITableViewCell, both grouped and simple, would be fantastic.

+8
ios uitableview
source share
2 answers

Do you know the debugger? He knows everything. To access the layout, try the following in gdb.

I set a breakpoint at - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath , which is called just before the cell is displayed

(note: there is a background image in my cell)

 (gdb) po cell <UITableViewCell: 0x59e9920; frame = (0 66; 320 44); text = '396 Studio'; autoresize = W; layer = <CALayer: 0x59e9a00>> (gdb) po [cell subviews] <__NSArrayM 0x4eaf730>( <UIImageView: 0x59ea660; frame = (0 0; 320 100); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x59ea690>>, <UITableViewCellContentView: 0x59e9eb0; frame = (9 0; 302 44); layer = <CALayer: 0x59ea070>> ) (gdb) po [[[cell subviews] objectAtIndex:1] subviews] <__NSArrayM 0x4eaf700>( <UILabel: 0x59e9170; frame = (0 0; 0 0); text = '396 Studio'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x59e91e0>>, <UITableViewLabel: 0x59e65c0; frame = (0 0; 0 0); text = 'Houston'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x59e6690>> ) (gdb) po [0x59e9170 font] <UICFFont: 0x5e12610> font-family: "Helvetica"; font-weight: bold; font-style: normal; font-size: 0px (gdb) p (CGRect)[cell frame] $1 = { origin = { x = 0, y = 66 }, size = { width = 320, height = 44 } } 

po = print object p = print, but you must specify the value in the form that, as you know,

no access to cell.frame resource - use objective-c methods [cell frame]

In addition, here is a 4-year-old but still useful article on iPhone fonts: a bold fireball .

+12
source share

I have subclassed UITableViewCell to get these values. Here is my code:

  dlog(@"%@",self.detailTextLabel.font); dlog(@"%@",self.detailTextLabel.bounds); dlog(@"%f",self.detailTextLabel.frame.size.height); dlog(@"%f",self.detailTextLabel.frame.size.width); dlog(@"%f",self.detailTextLabel.frame.origin.x); dlog(@"%f",self.detailTextLabel.frame.origin.y); dlog(@"%@",self.detailTextLabel.textColor); 

exit:

  2012-06-06 15:01:08.384 myapp[1007:f803] <mytablecell.m:(48)> <UICFFont: 0x68c8b20> font-family: "Helvetica"; font-weight: normal; font-style: normal; font-size: 14px//remember the text will shrink before hiding some with the "..." but this is default 2012-06-06 15:01:08.387 myapp[1007:f803] <mytablecell.m:(49)> (null) 2012-06-06 15:01:08.389 myapp[1007:f803] <mytablecell.m:(50)> 18.000000 2012-06-06 15:01:08.391 myapp[1007:f803] <mytablecell.m:(51)> 280.000000//its 284 if there is no accessory view(such as the checkmark I had in there when this ran) 2012-06-06 15:01:08.393 myapp[1007:f803] <mytablecell.m:(52)> 10.000000 2012-06-06 15:01:08.396 myapp[1007:f803] <mytablecell.m:(53)> 24.000000 2012-06-06 15:01:08.398 myapp[1007:f803] <mytablecell.m:(54)> UIDeviceRGBColorSpace 0.5 0.5 0.5 1 
+7
source share

All Articles