당신은 맞는 생각이 있습니다. UIPanGestureRecognizer
을 사용하여보기의 frame
을 업데이트 할 수 있습니다. 사용자가 항상 볼 수 있도록해야하는 항목이 있어야한다는 것을 명심하십시오. 화면에서보기를 완전히 숨길 수는 없을 것입니다.
- (void)handleDrag:(UIPanGestureRecognizer *)gesture {
if (gesture.state == UIGestureRecognizerStateChanged ||
gesture.state == UIGestureRecognizerStateEnded) {
CGPoint translation = [gesture translationInView:self.view];
CGRect newFrame = historyView.frame;
newFrame.origin.x = newFrame.origin.x + translation.x;
newFrame.origin.y = newFrame.origin.y + translation.y;
historyView.frame = newFrame;
// you need to reset this to zero each time
// or the effect stacks and that's not what you want
[gesture setTranslation:CGPointZero inView:self.view];
}
}
감사합니다 : 당신이 당신의 제스처 인식기에서 이벤트를 처리하기 위해 선택하는 개체의 구현에 갈 것 같은
뭔가 (이 샘플은 뷰 컨트롤러의 가정)! 나는 지금 그것을 얻는다라고 생각한다. –