У меня есть этот код, который работает очень медленно на iPad (почему-то намного быстрее на iPhone):
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self.navigationController setNavigationBarHidden:YES animated:NO];
mouseSwiped = YES;
UITouch *touch = [touches anyObject];
currentPoint = [touch locationInView:frontgroundView];
CGContextBeginPath(context);
CGContextMoveToPoint(context, lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(context, currentPoint.x, currentPoint.y);
CGContextStrokePath(context);
maskRef = CGBitmapContextCreateImage(context);
CGImageRef masked = CGImageCreateWithMask([backgroundImage CGImage], maskRef);
CGImageRelease(maskRef);
CGContextRef drawContext = UIGraphicsGetCurrentContext();
CGContextSaveGState(drawContext);
CGContextTranslateCTM (drawContext,0,frontgroundView.frame.size.height);
CGContextScaleCTM (drawContext, 1,-1);
CGContextDrawImage(drawContext, CGRectMake(0, 0, frontgroundView.frame.size.width, frontgroundView.frame.size.height), [frontgroundView.image CGImage]);
CGContextRestoreGState (drawContext);
CGContextDrawImage(drawContext, CGRectMake(0, 0, frontgroundView.frame.size.width, frontgroundView.frame.size.height), masked);
CGImageRef finalImage = CGBitmapContextCreateImage(drawContext);
frontgroundView.image = [UIImage imageWithCGImage:finalImage];
CGImageRelease(finalImage);
CGImageRelease(masked);
lastPoint = currentPoint;
mouseMoved++;
if (mouseMoved == 10)
mouseMoved = 0;
}
Есть идеи ??