【发布时间】:2014-04-10 01:28:27
【问题描述】:
我试图填充这个形状。但是使用我的代码,它会填充整个视图,而不是内部形状。
UIBezierPath *shape = [UIBezierPath bezierPathWithRect:self.bounds];
[shape moveToPoint:CGPointMake(self.bounds.size.width*0.15, self.bounds.size.height*0.6)];
[shape addCurveToPoint:CGPointMake(self.bounds.size.width*0.85, self.bounds.size.height*0.4)
controlPoint1:CGPointMake(self.bounds.size.width*0.1, self.bounds.size.height*0.3)
controlPoint2:CGPointMake(self.bounds.size.width*0.6, self.bounds.size.height*0.5)];
[shape addCurveToPoint:CGPointMake(self.bounds.size.width*0.15, self.bounds.size.height*0.6)
controlPoint1:CGPointMake(self.bounds.size.width*0.9, self.bounds.size.height*0.7)
controlPoint2:CGPointMake(self.bounds.size.width*0.4, self.bounds.size.height*0.5)];
[shape closePath];
[[UIColor blueColor] setFill];
[shape fill];
[[UIColor brownColor] setStroke];
[shape stroke];
有什么问题?当我画三角形或任何其他形状时,它可以完美地工作。
【问题讨论】:
标签: ios objective-c uiview drawing uibezierpath