在myRootViewController中,我将UIPanGesture
,UIPinchGesture
和UITapGesture
添加到myScrollView
。
-(void)viewDidLoad
{
//scroller's pan gesture
[scroller.panGestureRecognizer addTarget:self action:@selector(performScrollViewPanGesture:)];
//scroller's tap gesture
tapToEdit = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(performTapGesture:)];
tapToEdit.numberOfTapsRequired = 1.0;
[scroller addGestureRecognizer:tapToEdit];
//scroller's pinch gesture
pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(performPinchGesture:)];
[scroller addGestureRecognizer:pinchGesture];
}
由于我已将手势添加到myScrollView
,因此未调用ToucehsBegan
,但我还想使用ToucehsBegan
与touchesMoved
进行某些转换,所以我不得不创建一个名为BackgroundTouchLayerController
的单独类来调用TouchesBegan
,它是UIScrolView
的子类,我将其分配给myScrollView
。
在myScrollView
班级BackgroundTouchLayer
,我所做的就是这个。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//start Transformation of my Layers
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
//continues Tranforation
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//perform ending Animation
}
现在,它总是调用TouchesBegan
来进行我的转换,我面临的问题是,当我在iPhone Retina-4 [iPhone 5] (simulator)
中运行我的应用并执行Pan gesture
时,它会调用我的{ {1}}并且做的一切正确。但是当我在Pan gesture handler
中运行我的应用并执行iPhone [iPhone 4] (simulator)
时,它不会像Pan Gesture
那样调用Pan gesture handler
1}},而是从iPhone 5
类调用TouchesBegan
方法。
有谁知道,可能出了什么问题?
我尽力说清楚,如果仍然有需要,请问我。
提前致谢