我已经做了一个应用程序,我想让它多点触控兼容。我试过四处寻找,但答案并不是特定于我的。 这里是我做的:如何使多点触控启用iOS应用程序
1)我的编码:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesMoved:touches withEvent:event];
if (gameState == kGameStatePaused) {(gameState = kGameStateRunning);}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if(gameState == kGameStateRunning) {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if(location.x > 400) {
CGPoint yLocation = CGPointMake(playerPaddle.center.x, location.y);
playerPaddle.center = yLocation;
}
if (gameStyle == kGameStyleTwoP) {
if(location.x < 100) {
CGPoint yLocation2 = CGPointMake(computerPaddle.center.x, location.y);
computerPaddle.center = yLocation2;
}
}
}
2)我已经到界面生成器和检查多点触控启用
3盒)我建立并运行我的应用程序并打开正确,当我去测试多点触控我按住“选项键”,然后点击并移动鼠标
4)(我正在试图让computerPaddle和playerPaddle都移动),但只有一个作品在时间
我必须尝试解决它,但我不明白我要去哪里错了。
任何帮助都很有用。 THX。
我认为你有正确的想法,但xlc0212给了编码。无论如何 – burkel