我已經寫了如下的drawRect。iphone - 在設置背景視圖時在UITableViewCell中繪製一條線
-(void)drawRect:(CGRect)rect
{
[super drawRect:rect];
CGContextRef cxt = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(cxt, 2.0);
CGContextSetStrokeColorWithColor(cxt, [UIColor redColor].CGColor);
CGContextMoveToPoint(cxt, 250.0 , 0.0);
CGContextAddLineToPoint(cxt, 250.0, 50.0);
CGContextStrokePath(cxt);
}
它畫紅線。但是當我設置背景視圖到單元格行消失。我的觀點如下。
UIView *view = [[UIView alloc] initWithFrame:cell.frame];
view.backgroundColor = [UIColor grayColor];
cell.backgroundView = view;
什麼問題?背景視圖如何隱藏線條? 請幫忙
K但作爲名稱建議背景它應該在底部。現在我得到了。謝謝 – Durgaprasad 2013-04-24 09:58:53
它在底部。它的第一個子視圖。但子視圖不能低於自己的超視圖 - 這項工作應該如何,) – calimarkus 2013-04-24 10:02:07