views:

166

answers:

2

I would like to achieve a UITableViewCell to look like this image (following/tweets/etc):

alt text

A: 

Use CoreGraphics to draw the text and divide lines manually in a UITableViewCell subclass

(this is all Twitter for iPhone does)

rpetrich
I'm not familiar with CoreGraphics. Can you show me an example?
Sheehan Alam
Override `drawRect:`. Call `UIGraphicsGetCurrentContext` to get the current graphics context. Call `CGContextSetStrokeColorWithColor` to set the stroke color. Use `CGContextMoveToPoint` and `CGContextAddLineToPoint` to set a path. Use `CGContextStrokePath` to stroke the path.
rpetrich
A: 

A simpler solution would be to just add 5 subviews to the contentview of the cell in cellforrow, being 4 uitextfields and 1 uiview (the horizontal line). However, this will only be suitable for a tableview with a small number of rows as above as scrolling may suffer for long tables unless rpetrich's drawrect solution is adopted.

Run Loop