0

我显示了一个允许在里面绘制的弹出框。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    mouseSwiped = NO;
    UITouch *touch = [touches anyObject];
    lastPoint = [touch locationInView:self.view];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    mouseSwiped = YES;
    UITouch *touch = [touches anyObject];
    CGPoint currentPoint = [touch locationInView:self.view];

     NSLog(@"lastPoint: %@", NSStringFromCGPoint(lastPoint));

    UIGraphicsBeginImageContext(self.view.frame.size);
    [mainImage.image drawInRect:CGRectMake(0, 0, 600, 400)];
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), brush );
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), red, green, blue, 1.0);
    CGContextSetBlendMode(UIGraphicsGetCurrentContext(),kCGBlendModeNormal);

    CGContextStrokePath(UIGraphicsGetCurrentContext());
    mainImage.image = UIGraphicsGetImageFromCurrentImageContext();
    [mainImage setAlpha:opacity];
    UIGraphicsEndImageContext();

    lastPoint = currentPoint;
}

我的问题是自从iOS13以来,它的显示效果不佳。

它应该如何显示:
在此处输入图像描述

它现在在 iOS13 中的显示方式:
在此处输入图像描述

有任何想法吗?

4

0 回答 0