헤이 목적 C의 메신저 초보자는 터치 온 라인 그리기 방법?
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
if ([touch view] == self.view) {
CGPoint location = [touch locationInView:self.view];
loc1 = location;
CGContextMoveToPoint(context, location.x, location.y);
NSLog(@"x:%d y:%d At Touch Begain", loc1.x, loc1.y);
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
if ([touch view] == self.view)
{
CGPoint location = [touch locationInView:self.view];
CGContextMoveToPoint(context, loc1.x, loc1.y);
NSLog(@"x:%d y:%d At Touch Move", loc1.x, loc1.y);
CGContextAddLineToPoint(context, location.x, location.y);
NSLog(@"x:%d y:%d", location.x, location.y);
}
}
내가있는 viewDidLoad 방법에 텍스를 선언 나에게 내가 코드를 다음 있지만 작동하지 만든다
를 ..... 도와 또한 터치 이벤트에 선언하려고하지만하십시오 작업 ...
내 응용 프로그램 로그 파일보기와 같은 ...
X : 0 Y : 터치 이동 목 1월 13일 11시 20분 5초 .local의 끌어서 놓기에서 1079934976 [536 ]
CGContextAddLineToPoint : 20 : 11 2011-01-13 잘못된 상황이 0x0 05.149 끌어서 놓기 [536 : 207] X : 0 Y : 1079902208 목 일월 13 11시 20분 5초 .local의 끌어서 놓기 [536]
CGContextSetRGBStrokeColor 잘못된 상황이 0x0 목 일월 13 11시 20분 5초 .local의 끌어서 놓기 [536]
CGContextDrawPath 잘못된 상황이 0x0 목 일월 13 11시 20분 5초 .local의 끌어서 놓기 [536]
CGContextMoveToPoint : 유효하지 않은 컨텍스트 0x0 2011-01-13 11 : 20 : 0 5.199 끌어서 놓기 [536 : 207] X : 0 Y :
CGContextAddLineToPoint : 터치 이동 목 일월 13 11시 20분 5초 .local의 끌어서 놓기 [536] 위치에 1,079,934,976 잘못된 상황이 0x0 2011-01-13 11:20 : 05.200 끌어서 놓기 [536 : 207] X : 0 Y : 1079885824