【发布时间】:2014-09-25 07:50:51
【问题描述】:
这里的目标是,当我点击 UIImageview 右侧或左侧的屏幕时,Int 侧移动会更改以创建向左或向右移动。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
if (image.center.x > touchLocation) {
sidemovement = -2;
}
if (if (image.center.x < touchLocation) {
sidemovement = 2;)
[self jump];
}
问题是我希望将 CGpoint 触摸位置与 image.center.x 位置进行比较,并以此确定图像应该向左还是向右移动?
谢谢!
【问题讨论】: