Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Aany

macrumors newbie
Original poster
Jun 24, 2011
7
0
France
Sorry for posting here I am new to this forum. Now I know Where to post it. But I can't delete this one.
Hi,
I am developping an app which calculates camera lens parameters. It has an area which shows a camera view where user can drag and set camera distance etc. I want to draw a triangle between a fixed point and two others which move when user touches and drags them. I managed to draw this triangle but the problem is that every time user touches or moves the dot a new triangle appears while i only want one. I used the following code:
in touchesMoved:

UIGraphicsBeginImageContext(self.view.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(),0,0,0,1);
CGPoints[CGPointMake(0,100), CGPointMake(location.x,location.y), CGPointMake(location.x,location.y), CGPointMake(newLoc.x,newLoc.y), CGPointMake(newLoc.x,newLoc.y), CGPointMake(0,100)]
//draw is my imageView
draw.image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext()

Thanks in advance
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.