2

如何在 UIImageView 的图像上方绘制贝塞尔曲线。我在图像视图的角落使用 UIBezierCurve 对 UIImageView 进行子类化并绘制圆圈。但是,一旦我将图像放在 UIImageView 中,圆圈的内部部分就会被图像重叠。那么有没有什么解决方案可以让我在 uiimageview 的 UIimage 上绘制 UIBezier 路径?

4

1 回答 1

2

您可以尝试使用实例方法对简单的子类进行子类化UIView并自己绘制图像。它应该看起来像这样:drawInRect:UIImage

- (void)drawRect:(CGRect)dirtyRect {
    // note you can get image from anywhere
    UIImage *image = [UIImage imageNamed:@"MyImage"];

    [image drawInRect:self.bounds];

    // now that image is drawn, everything
    // past this point will be drawn on top of it
    ...
}
于 2012-06-11T10:32:20.543 回答