我正在构建的iphone应用程序中无法使用多点触控功能

Bry*_*imo 3 iphone objective-c ipod-touch

我有以下代码:

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


NSUInteger touchCount = 0;
// Enumerates through all touch objects
for (UITouch *touchb in touches){
    touchCount++;
}


// When multiple touches, report the number of touches. 
if (touchCount > 1) {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking %d touches", touchCount];
} else {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking 1 touch", touchCount];
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,它永远不会检测到多个触摸.是否有一些设置可能会阻止我的应用进行多次触摸?或者我在这里遗漏了什么?

epa*_*tel 10

您需要在InterfaceBuilder中的View上启用"Multiple Touch"

替代文字http://img.skitch.com/20090227-rpkafsxtg56pujk1h1583if88i.jpg

或者,如果您在代码中创建了视图,则设置为

[theView setMultipleTouchEnabled:YES];
Run Code Online (Sandbox Code Playgroud)