UIPanGestureRecognizer를 스크린 샷에 추가 한 직후에 시작하고 싶습니다. 스크린 샷은 코드를 통해 만들어 지므로 항목이 강조 표시되면 사용자가 화면을 다시 누르지 않습니다. 그럼 ... 어떻게 인식기를 프로그래밍 방식으로 시작합니까?프로그래밍 방식으로 UIGestureRecognizer 시작
UIView *snapshot = [cell snapshotViewAfterScreenUpdates:NO];
//use the cell to map the snapshot frame to the window because this does a perfect job of accounting for table offset, etc. Other methods put the view a little to the side or way off
CGRect newFrame = snapshot.frame;
newFrame.origin = [cell convertPoint:newFrame.origin toView:self.view.window];
[snapshot setFrame:newFrame];
[HelperMethods shadowForView:cell color:[UIColor blackColor] offset:CGSizeMake(1, 1) opacity:.7 radius:snapshot.frame.size.width/4];
//[self.view addSubview:snapshot];
newFrame.origin.y -=10;
//move the frame a little to let user know it can be moved
[UIView animateWithDuration:.2 animations:^{
[snapshot setFrame:newFrame];
}];
//add a long press that kills the tap if recognized
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(userCellDragged:)];
[pan setMinimumNumberOfTouches:1];
[pan setMaximumNumberOfTouches:1];
[cell addGestureRecognizer:pan];
:
당신 같은이 방법 뭔가에 매개 변수를 추가해야합니다 단순히
을 추가하여보기에서 어디에서나 부를 수있는? – Larme그렇다면 "userCellDragged"메서드를 트리거하고 실제로 제스처 인식기에 의해 트리거 된 경우받을 인수를 전달하는 방법을 파악하려고합니다. – ezekielDFM
수정. [UILongPressGesture를 프로그래밍 방식으로 어떻게 전송할 수 있습니까?] –