【发布时间】:2012-02-26 21:35:58
【问题描述】:
到目前为止我有这个代码:
CGPoint midLeft = CGPointMake(0, additionalHeight);
CGPoint bottomCenter = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height);
CGPoint midRight = CGPointMake(self.bounds.size.width, additionalHeight);
CGPoint topRight = CGPointMake(self.bounds.size.width, 0);
CGPoint topLeft = CGPointMake(0, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, midLeft.x, midLeft.y);
CGContextAddLineToPoint(context, midRight.x, midRight.y);
CGContextAddLineToPoint(context, topRight.x, topRight.y);
CGContextAddLineToPoint(context, topLeft.x, topLeft.y);
CGContextClosePath(context);
现在,它只是给我画了一个矩形,但我希望它给我画一个弧线,向下延伸到底部中心,就像这张图片顶部的形状:
我尝试过 CGContextAddArc 和 AddArcToPoint,并按照教程进行操作,但我不知道如何绘制这种弧。任何帮助表示赞赏。
【问题讨论】:
标签: iphone objective-c core-graphics