gpt4 book ai didi

iphone - 多点触控在我正在构建的 iphone 应用程序中不起作用

转载 作者:搜寻专家 更新时间:2023-10-30 19:53:52 24 4
gpt4 key购买 nike

我有以下代码:

- (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];
}

当我运行它时,它从未检测到超过一次触摸。是否有某些设置可能会阻止我的应用进行多次触摸?或者我在这里遗漏了什么?

最佳答案

您需要在 InterfaceBuilder 中的 View 上启用“多点触控”

alt text http://img.skitch.com/20090227-rpkafsxtg56pujk1h1583if88i.jpg

或者如果您已经在代码中创建了 View ,它是用

[theView setMultipleTouchEnabled:YES];

关于iphone - 多点触控在我正在构建的 iphone 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/596638/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com