Drawing string in custom UITableViewCell

I am setting up the drawing text in a custom UITableViewCell, but I struggle to line up the line to emphasize the text.

I am currently trying to do the following:

CGContextMoveToPoint(context, pt.x, pt.y+sz.height);
CGContextAddLineToPoint(context, pt.x+sz.width, pt.y+sz.height);

      

but although the code is being called, nothing is drawn. I am probably doing something stupid, but I cannot figure out what it is.

+2


source to share


1 answer


I've been caught by the same thing in the past. What you wrote just sets the line to be drawn. You need to call something like this to draw the line:



    CGContextStrokePath(context);

      

+6


source







All Articles