0

我在一个视图上有 4 个图像视图。我想让 4 个图像可移动。我使用了触摸移动方法。它似乎适用于我的 3 个图像视图。但是第四个没有移动。在所有情况下都检测到触摸我已通过 NSlog 验证。请帮助。

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:self.view];
    if ([touch view] == textstyleImage) {
        textstyleImage.center = location; 
        }
    else if ([touch view] == clipartImage){
        clipartImage.center = location;

    }
    else if([touch view] == customMessage){
        customMessage.center = location;
    }
    else if([touch view] == galleryImage){
        galleryImage.center = location;
    }
}
4

1 回答 1

1

像这样为该图像视图启用用户交互

[fourthImageView setUserInteractionEnabled:YES];

并再次测试。

于 2012-06-19T05:29:43.520 回答