方法不能在iPhone(模拟器)中调用,但它在iPhone Retina 4-iPhone5(模拟器)上工作正常

时间:2012-12-26 11:50:52

标签: objective-c ios uiscrollview uigesturerecognizer xcode4.5

在myRootViewController中,我将UIPanGestureUIPinchGestureUITapGesture添加到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,但我还想使用ToucehsBegantouchesMoved进行某些转换,所以我不得不创建一个名为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方法。

有谁知道,可能出了什么问题?

我尽力说清楚,如果仍然有需要,请问我。

提前致谢

0 个答案:

没有答案