Draw Line usando CGContext

Quero desenhar uma linha na célula de exibição de tabela para poder colocar o campo de texto e alternar na célula única. Aumentei a altura da célula. Como posso desenhar uma linha na célula?

Tenho uma subclasse de UIView que contém o seguinte código

 //Get the CGContext from this view
 CGContextRef context = UIGraphicsGetCurrentContext();
 //Set the stroke (pen) color
 CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
 //Set the width of the pen mark
 CGContextSetLineWidth(context, 1.0);

 // Draw a line
 //Start at this point
 CGContextMoveToPoint(context, 10.0, 30.0);

 //Give instructions to the CGContext
 //(move "pen" around the screen)
 CGContextAddLineToPoint(context, 310.0, 30.0);


 //Draw it
 CGContextStrokePath(context);

Então eu tenho um tableViewController com estilo de tabela agrupada. Em cellForRowAtIndexPath, tenho o seguinte código

//code to add textfield
DrawLineView *drawLine = [[DrawLineView alloc]init];
[cell addSubview:drawLine];
//code add switch

Mas não está desenhando nenhuma linha. Não posso usar 2 células diferentes. Eu tenho que, por favor me ajude. Este é o meu primeiro a lidar com gráficos no iphone. Obrigad

questionAnswers(3)

yourAnswerToTheQuestion