0
我有一個非常奇怪的問題。在iOS8中,只有ipad 2(適用於所有設備上的iOS7和iOS8中的迷你),我擁有的簽名面板會在用戶將手指放在UIImageView上的時間越長時,使線條/繪製對象消失。用CoreGraphics繪製的iOS8線條隨着時間在UIImageView中褪色
谷歌搜索沒有提供任何想法嗎?這裏是用戶圖紙的繪圖代碼。
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
swiped = YES;
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
currentPoint.y -= 20;
UIGraphicsBeginImageContext(self.view.frame.size);
[_drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
_drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
}
你試過用CGContextRef context = UIGraphicsGetCurrentContext();作爲一個變量..並使用上下文來代替UIGraphicsGetCurrentContext()..? – 2014-10-07 16:21:58
有趣...是的,讓我試試 – JMD 2014-10-08 13:28:13
我試過在iOS8中測試你的代碼,它的工作正常:/。 – 2014-10-08 14:19:00