1
我遇到了我正在繪製的應用程序的問題。目標C:觸摸點距離
在肖像其接觸點是好的,該行遵循正確的接觸點,但是當我的方向切換到橫向這裏發生了什麼事:
紅色的X標誌是觸摸點,但線在不同的點開始。
我要怎麼解決這個問題?
這裏是我的代碼:
在viewDidLoad中:
touchView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bgimg.png"]];
[touchView setFrame:CGRectMake(0, 0, 768, 1024)];
[self.view addSubview:touchView];
[self.view sendSubviewToBack:touchView];
touchMoved = 0;
touchView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
上touchesMoved:
UIGraphicsBeginImageContext(self.view.frame.size);
[touchView.image drawInRect:CGRectMake(0, 0, 768, 1024)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 25.0f);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0, 0, 0, 1);
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), endingPoint.x, endingPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentTouch.x, currentTouch.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
touchView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
是的,這是從不同的UIImageView ... – Cristiano