触摸在iOS5中不工作,在iOS4中工作正常

触摸在iOS5中不工作,在iOS4中工作正常,ios5,ios4,scrollview,touches,Ios5,Ios4,Scrollview,Touches,我有一个自定义scrollView,实现了以下方法: - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { //if not dragging send it on up the chain if(!self.dragging){ [self.nextResponder touchesEnded:touches withEvent:event]; }else {

我有一个自定义scrollView,实现了以下方法:

  - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
 {
     //if not dragging send it on up the chain
     if(!self.dragging){
    [self.nextResponder touchesEnded:touches withEvent:event];
     }else {
        [super touchesEnded:touches withEvent:event];

     }
  }
在我的视图控制器中,我有以下方法:

-(void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {


NSLog(@"TOUCH");
//---get all touches on the screen---

NSSet *allTouches = [event allTouches];



//---compare the number of touches on the screen---

switch ([allTouches count])

{

        //---single touch---

    case 1: {

        //---get info of the touch---

        UITouch *touch = [[allTouches allObjects] objectAtIndex:0];



        //---compare the touches---

        switch ([touch tapCount])

        {

                //---single tap---

            case 1: {
                NSLog(@"Single");

                [self mySingleTapMethod];
            } break;



                //---double tap---

            case 2: {

                [self myDoubleTapMethod];
            } break;

        }

    }  break;

}
}


在iOS 4下,它工作得很好,scrollview上的触摸被识别,touchesEnded在我的视图控制器中被调用,一切正常。然而,在iOS 5x下,TouchSended永远不会被解雇。有人知道到底出了什么事吗

在这里找到了答案,基本上,如果你想做我正在做的事情,你需要通过接触,并开始向上移动。。因为如果viewController没有看到触摸开始,它将不会看到触摸结束。。。因此,我修改了自定义滚动视图以抛出touchsbeging,现在一切都可以在5.0中正常工作

参考:


IOS 5中的问题似乎与调用ScrollView从未到达ViewController中的触摸有关。。scrollView中的touchSedend确实会被触发。