XCode 4.2로 작업하고 UIGestureRecognisers로 그립을 잡으려고합니다. 모든 것이 지금까지 상당히 잘 진행되고있는 것처럼 보이지만 여전히 몇 가지 문제가 있습니다.UIPanGestureRecogniser의 문제점
스 와이프 제스처 인식기를 사용할 때 모든 것이 좋았습니다. 모든 방향에서 스 와이프를 인식하고 계속 그렇게 할 것입니다. 내 문제는 이제 팬 제스처 인식기를 사용할 때 첫 번째 팬 스 와이프 괜찮은 인식하지만 다음 모든 추가 제스처 받아 들일 그냥 거부합니다. 필요한만큼 항목을 한 번 이동할 수 있지만 그 이후에는 아무 것도 할 수 없습니다.
이- (void)panBody:(UIPanGestureRecognizer *)recognizer
{
CGPoint translate = [recognizer translationInView:self.view];
CGRect bodyPanelFrame = bodyPanel.frame;
bodyPanelFrame.origin.x += translate.x;
bodyPanelFrame.origin.y += translate.y;
recognizer.view.frame = bodyPanelFrame;
CGRect topPanelFrame = topPanel.frame;
topPanelFrame.origin.x += translate.x;
topPanelFrame.origin.y += translate.y;
recognizer.view.frame = topPanelFrame;
CGRect sidePanelFrame = sidePanel.frame;
sidePanelFrame.origin.x += translate.x;
sidePanelFrame.origin.y += translate.y;
recognizer.view.frame = sidePanelFrame;
NSLog(@"Panning");
if (recognizer.state == UIGestureRecognizerStateEnded)
{
bodyPanel.frame = bodyPanelFrame;
if((topPanel.frame.origin.x + translate.x) <= 193)
{
topPanel.frame = CGRectMake(topPanelFrame.origin.x, topPanel.frame.origin.y, topPanel.frame.size.width, topPanel.frame.size.height);
}
else
{
topPanel.frame = CGRectMake(193, 0, topPanel.frame.size.width, topPanel.frame.size.height);
NSLog(@"Top panel not in frame");
}
if((sidePanel.frame.origin.y + translate.y) < 57)
{
sidePanel.frame = CGRectMake(sidePanel.frame.origin.x, sidePanelFrame.origin.y, sidePanel.frame.size.width, sidePanel.frame.size.height);
}
else
{
sidePanel.frame = CGRectMake(0, 56, sidePanel.frame.size.width, sidePanel.frame.size.height);
NSLog(@"Side panel not in frame");
}
}
}
bodyPanel, topPanel 및 sidePanel는 IBOutlets가있는 UIView의이 오버레이에 연결되어 있습니다 :
UIPanGestureRecognizer *panBody = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panBody:)];
[bodyGestureView addGestureRecognizer:panBody];
다음이 모두를 처리하는 내 'panBody'방법으로 다음과 같이
은 내 제스처를 설정 내 인터페이스 상단에있는 .xib
누구든지이 정보를 밝힐 수 있다면, 그게 무슨 일이 벌어지는 지 전혀 몰라요!
감사합니다,
매트