嗨,我是用下面这段代码,让用户在我的应用程序在一个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