Sea*_*ser 6 core-graphics objective-c uitableview ios
我在使用自定义UITableViewCell的drawRect方法时遇到了麻烦.这是我正在使用的代码
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGPoint origin = _faceView.frame.origin;
CGFloat width = _faceView.frame.size.width;
CGFloat height = _faceView.frame.size.height;
CGFloat border = 2.0f;
CGPoint startPt = CGPointMake(origin.x + width/2, self.frame.size.height);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, startPt.x, startPt.y);
CGPoint basePt = CGPointMake(startPt.x, origin.y - height - border);
CGContextAddLineToPoint(ctx, basePt.x, basePt.y);
CGRect circleRect = CGRectMake(origin.x - border, origin.y - border, width + 2 * border, height + 2 * border);
CGContextAddEllipseInRect(ctx, circleRect);
UIColor *color = [UIColor redColor];
CGContextSetFillColorWithColor(ctx, color.CGColor);
CGContextSetStrokeColorWithColor(ctx, color.CGColor);
CGContextSetLineWidth(ctx, 1.0f);
CGContextDrawPath(ctx, kCGPathFillStroke);
}
Run Code Online (Sandbox Code Playgroud)
我已经调试过以确保所有数值都有意义,看起来它们确实存在.无法真正找出屏幕上没有任何内容的原因.
值得一提的是,这也是一个在笔尖中定义的单元格.我正在使用iOS 7 sdk构建.
有任何想法吗?
tahnks
Ant*_*esm 15
尝试将backgroungcolor属性设置为透明色
self.backgroundColor = [UIColor clearColor]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10284 次 |
| 最近记录: |