我被困了。我有3个物体,我喜欢在屏幕上移动,但不是在同一个地方。我的IF声明有什么问题?在Debug中,我总是在else语句中。谢谢你的帮助!
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if ([touch view] == himmel) {
himmel.center = location;
} else if ([touch view] == hoelle) {
hoelle.center = location;
}
else if ([touch view] == regel) {
regel.center = location;
}
else {
NSLog(@"FAIL");
}
}
TouchesMoved
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}