2012-05-04 49 views
1

我用下面的代碼來檢測對象的touchesBegan不會被觸發

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSArray *allTouches = [touches allObjects]; 

    for (UITouch *touch in allTouches) 
    { 
      NSLog(@"TOUCH DETECT"); 

    } 
} 

上的觸摸,但它不會被觸發

歡迎任何評論

回答

5

什麼樣的對象?僅針對UIResponder子類調用touchesBegan:withEvent:

此外,如果它是UIView,請確保userInteractionEnabled爲YES。