0

在我的应用程序中,我想在屏幕上(用户触摸的地方)画一个点。添加后,我保存incrementalImage,下一个点将添加到此图像中。

问题是,第一点没有出现。我错过了什么?

    UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0.0);

    if (!self.incrementalImage) // first time; paint background white
    {
        UIBezierPath *rectpath = [UIBezierPath bezierPathWithRect:self.bounds];
        [[UIColor whiteColor] setFill];
        [rectpath fill];
    }
    [self.incrementalImage drawAtPoint:CGPointZero];

    CGContextFillEllipseInRect(UIGraphicsGetCurrentContext(), CGRectMake(point.x - roundf(_lineWidth / 2.0), point.y - roundf(_lineWidth / 2.0), _lineWidth, _lineWidth));

    self.incrementalImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
4

0 回答 0