在iPhone的UITableViewCell中,在何处编写绘制正方形的代码

在iPhone的UITableViewCell中,在何处编写绘制正方形的代码,iphone,Iphone,我有下面的代码用下面的代码画一个正方形的轮廓 CGContextRef context = UIGraphicsGetCurrentContext(); CGContextClipToRect(context, CGRectMake(0.0, 00.0, 50, 50)); CGContextSetLineWidth(context, 3.0); CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0); CGContextStrokeRec

我有下面的代码用下面的代码画一个正方形的轮廓

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextClipToRect(context, CGRectMake(0.0, 00.0, 50, 50));
CGContextSetLineWidth(context, 3.0);
CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);
CGContextStrokeRect(context, CGContextGetClipBoundingBox(context));
我想把这个方块画进UITableViewCell。那么我应该在哪里写cocde来在那个单元格中画一个正方形呢。
我想画

你可以把这段代码写到cellForRowAtIndexPath方法的表中

我已经编写了以下代码来在tablecell中添加两个标签

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
   static NSString *cellId=@"Cell";
   UITableViewCell *cell=[tableView dequeReusableCellWithIdentifier:cellId];

   if(cell==nil)
   {
       cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
   }

   // you can put down you logic of customizing your cell here.
   //for example see mine code.

   CGRect frm1=CGRectMake(10,10,290,25);
   UILabel *lbTmp;
   lbTmp=[[UILabel alloc] initWithFrame: frm1];
   lblTmp.text=@"something something"
   cell.contentView addSubview:lb1Tmp];
   [lblTmp release];
   return cell;
}