난 그냥 .. 나는 다음과 같은 코드를 작성했지만 그것은 선을 표시하지의 형태의 ViewController의 내 같은 관점에서 서로 다른 두 점 사이의 선을 그어야 할 .. .. 내가이 문제를 해결하는 데 도움이 바랍니다아이폰에서 같은보기에있는 두 개의 다른 점 사이에 선을 그리는 방법은 무엇입니까?
- (void)drawRect:(CGRect)rect
{
[brushPattern setStroke];
[myPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
// CGPoint *point=mytouch
[myPath moveToPoint:[mytouch locationInView:self.view]];
CGPoint pos = [mytouch locationInView: self.view];
NSLog(@"Position of touch: %.3f, %.3f", pos.x, pos.y);
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[myPath addLineToPoint:[mytouch locationInView:self.view]];
[self.view setNeedsDisplay];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
CGPoint pos = [mytouch locationInView: self.view];
NSLog(@"Position of touch: %.3f, %.3f", pos.x, pos.y);
}
안녕하세요 ... 저는이 문제를 인터넷 검색으로 해결했습니다. 고맙습니다 .. :) –