我已經存儲我的NSPoint像這樣的數組。我想給該數組輸入到另一個類來繪製相同的操作。如何繪製特定的數組值。繪製線使用NSpoint像素與陣列
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self];
CGPathAddLineToPoint(self.currentLine.linePath, NULL, currentPoint.x, currentPoint.y);
[self setNeedsDisplay];
[_array addObject:[NSValue valueWithCGPoint: currentPoint]];
}
這是我的數組值 控制檯輸出
"NSPoint: {745, 575}",
"NSPoint: {730, 584}",
"NSPoint: {717, 588}",
"NSPoint: {701, 590}",
"NSPoint: {678, 590}",
"NSPoint: {642, 590}",
"NSPoint: {590, 590}",
"NSPoint: {520, 590}",
"NSPoint: {465, 589}",
"NSPoint: {438, 587}",
"NSPoint: {415, 587}",
"NSPoint: {403, 582}"
- (void)drawRect:(CGRect)rect
{
// CGContextSetAlpha(context, self.currentLine.opacity);
// CGContextSetStrokeColorWithColor(context, self.currentLine.lineColor.CGColor);
// CGContextSetLineWidth(context, self.currentLine.lineWidth);
// CGContextSetLineCap(context, kCGLineCapRound);
// CGContextSetLineJoin(context, kCGLineJoinRound);
// CGContextBeginPath(context);
// CGContextAddPath(context, self.currentLine.linePath);
// CGContextStrokePath(context);
???????????
}
這個代碼將使用觸摸輸入線drawing.how來繪製出用戶交互 線時的視圖將衝擊片雷管。這子類的UIView。我可以繪製使用mouse.my需要是我有CGPoint值數組我想要傳遞該數組到這個類輸入的繪圖line.how我可以通過這
call this viewWllAppear – 2012-02-08 09:55:48
@InderKumarRathore call this?哪一個我必須打電話? – 2012-02-08 10:04:15
在'viewWillAppear'調用'drawRect' – 2012-02-08 10:14:17