UIView 서브 클래 싱이 처음에는 내보기가 기본 색으로되어 있고 여기에 문제가있는 x 축 = 0에서 사용자가 접촉 한 지점에서 다른 색으로 채울 필요가 있습니다. touchesMoved입니다. 내 자체 뷰 경계 밖으로 드래그해도 그 점을 얻고 있습니다. 내 자체 뷰 경계에서만이를 제한하는 방법입니다. touchesMoved 내 뷰 경계 밖으로 도달
나는- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
endPoint = point;
NSLog(@"moved x: %f,y: %f",point.x,point.y);
if(CGRectContainsPoint([self frame], endPoint)){ // this also not working
[self fillColor];
}
}
어떤 도움 사전에 감사합니다, &은 다음과 같습니다 조각 아래에 있지만 이 방법을있는 touchesMoved 내 행운
if([self pointInside:point withEvent:nil]){
[self fillColor];
}
의 노력 봤.
것은 위의 코드 스 니펫은 내보기 클래스 (fillColorView)에 &이보기를 만들고있어 [anyParentViewController addSubView : fillColorView] 그래서 내가 이것을 사용할 때 anyParentV 필자는 필자가 fillColorView에서 손가락을 드래그하더라도 내 anyParentViewController에서 채우기 색상 인 fillColorView로 손가락을 드래그하더라도 UI가 실행 중입니다. –
CGPoint pointToMove = [탭 위치 정보보기 : fillColorView]; 또한 내 벨로우즈 코드 친구를 사용하십시오 또한 사용보기에서 선을 그릴 수있는 iPad이 응용 프로그램 의이 유형을 만들 –
fillColorView 친구를위한 @GrahamBell 세트 태그도 업데이트 된 대답을 참조하십시오 .. –