내 메인보기에서 scrollview가 있고 내 scrollview에 세 개의 하위보기가 있습니다. 그리고 모든 하위 뷰에 UIButtons가 있습니다.UIScrollView에서 UIButtons 끌기?
이제 하위 버튼 하나를 다른 하위보기로 드래그하려고합니다 (버튼을 드래그하는 동안 스크롤보기가 스크롤되지 않아야 함).
어떻게하면됩니까? 나는이 조각의 (a있는 UIScrollView 내부 UIControl)이 특정 사건에 대한 작동하지만, UIResponder 체인에 대한 이해가이 작동하는 경우는 (
- (void)viewDidLoad { // or wherever you initialize your things
...
// Add swipe event to UIButton so it will capture swipe intents
UIPanGestureRecognizer *panGR = [[UIPanGestureRecognizer alloc] init];
[panGR addTarget:self action:@selector(panEvent:)];
[button addGestureRecognizer:panGR];
[panGR release];
}
- (void)panEvent:(id)sender {
button.center = [sender locationInView:self.view];
}
을 :)해야한다고 저를 제시하면 완전히 확실하지 않다
수행하기 위해, 난 그냥 button.center하는 정확한 지점을 지정하려면, help.Button 동시에 finely.At 이동 귀하의 종류 U 너무 감사 정확한 움직임, 나는 touches를 사용해야합니다 .Began, touchesMoved, touchesEnded.이 방법을 사용할 때, fuctionality가 작동하지 않습니다. ..... 어떻게 할 것인가? – user1048990
touchesBegan, Moved 및 Ended를 사용하여 시작하면 모든 제스처 및 응답 체인 기능이 취소됩니다. UIPanGestureRecognizer를 사용하면 locationInView를 사용하여 터치의 정확한 위치에 액세스 할 수 있습니다.이 인터페이스는 매개 변수 (이 경우 기본보기)로 전달한 뷰를 기준으로 CGPoint를 반환합니다. 네 사건에 맞지 않니? –