我在滚动视图中有 3 个视图,并且我对这些子视图进行了滑动手势。
在滑动时,我正在使用 (CATransform3DMakeRotation) 旋转该视图,同时滚动我的滚动视图以提供页面折叠效果。
它按预期工作,但子视图并非每次都检测到滑动。
实施后
– gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
和
– gestureRecognizer:shouldReceiveTouch:
子视图每次都检测到滑动,但现在滚动动画不起作用。
现在它在视图旋转动画结束时滚动(没有动画)。
我用过的代码
//Animation Code
[UIView animateWithDuration:3 animations:^(void){
CATransform3D _3Dt = CATransform3DIdentity;
_3Dt = CATransform3DConcat(CATransform3DMakeRotation(M_PI, 0.0f, 7.5f, 0.0f), CATransform3DMakeTranslation(0, 0, 0));
_3Dt.m34 = 0.0015f;
v.layer.transform = _3Dt;
//[scroll setContentOffset:CGPointMake(scroll.contentSize.width-300, 0)];
[scroll scrollRectToVisible:CGRectMake(300, 10, 300, scroll.frame.size.height) animated:NO];
} completion:^(BOOL finished){}];
and
//GestureRecognizer Delegate
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return YES;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
return YES;
}
请提出一些建议