嗨,我是用下面這段代碼,讓用戶在我的應用程序在一個UIView組件「畫」的招牌:繪製的圖像完全是出於
UIGraphicsBeginImageContext(signature.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, signature.frame.size.width, signature.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
CGContextFlush(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext()
我遇到的問題是,繪圖不僅在繪圖時與模擬器中的指針不一致,圖像超出了指定的UIView組件範圍,而且越來越小,聚焦越多,就像您在此圖像中看到的那樣: alt text http://dl.dropbox.com/u/1545603/iphone-signature-issues.png
並在幾行後顯示確切的邊界是我可以畫的地方: alt text http://dl.dropbox.com/u/1545603/iphone-signature-issues2.png
關於這裏發生了什麼的任何想法?
lastPoint.y
被定義爲:lastPoint.y -= 20;
在地球上這裏發生了什麼任何想法?
TY丹:)我的iPhone上試過了,這是相同的:( – bear 2010-04-07 20:09:19