늦게 답장을 보내 드려 죄송합니다. 이 질문을 보았습니다.
당신은 당신의 슬쩍 작업의 가장자리에서 발생 기본보기 (왼쪽 및 오른쪽)이 맨 끝에서 파단을 만든 다음 (30)의 폭 또는 40
을 부여하려면
나는 다른 관점에서 popin을 왼쪽에서 오른쪽으로 믿는다. 따라서 inorder를 사용하면 메인 뷰 상단에 2 개의 뷰를 추가해야합니다. 이제 왼쪽보기의 경우 주보기에 연결하는 오른쪽 수평 공간 제약 조건을 주보기의 (-1) x 너비보다 작은 값으로 설정하십시오. 우측 뷰의 뷰 모두
X가 약자 메인 뷰 외부 지도록 오른쪽 horizondal 공간 제약은, 메인 뷰의 폭보다도 큰 값으로 메인 뷰에 연결 설정 내용 메인 뷰의 너비보다 크거나 같은 값
두 개의 NSLayoutConstraint 변수를이 두 값을 유지하는 IBOutlet으로 추가하십시오.
NSLayoutConstraint *leftViewHorizondalRightPadding;
NSLayoutConstraint *rightViewHorizondalRightPadding;
이제 이러한 하위 뷰 (주황색 표시)에 UISwipeGestures를 추가하십시오. 오른쪽에서 왼쪽으로 왼쪽에서 오른쪽으로
UISwipeGestureRecognizer *leftToRightSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
[leftToRightSwipe setDirection:UISwipeGestureRecognizerDirectionRight];
[self.leftSubview addGestureRecognizer:leftToRightSwipe];
UISwipeGestureRecognizer *rightToLeftSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
[rightToLeftSwipe setDirection:UISwipeGestureRecognizerDirectionLeft];
[self.rightSubview addGestureRecognizer:rightToLeftSwipe];
///Now in the swipe handler distinguish the swipe actions
-(void)handleSwipe:(UISwipeGestureRecognizer *)recognizer {
NSLog(@"Swipe received.");
if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) {
//It's leftToRight
leftViewHorizondalRightPadding.constant = 0;
[UIView animateWithDuration:1
animations:^{
[self.view layoutIfNeeded];
}];
}
else {
//It's rightToLeft
rightViewHorizondalRightPadding.constant = 0;
[UIView animateWithDuration:1
animations:^{
[self.view layoutIfNeeded];
}];
}
}
}
이 슬쩍 애니메이션을 만들 것입니다.당신은 그것을 위해 슬쩍 제스처를 사용할 수 있습니다
이 도움이
희망은 ... ... 당신이 좌우 및 상하 슬쩍 슬쩍 제공 할 것입니다. –