Uiimageview不动

时间:2012-06-19 05:07:26

标签: iphone uiimageview

我在一个视图上有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;
    }
}

1 个答案:

答案 0 :(得分:1)

为此图片视图启用用户互动,例如

[fourthImageView setUserInteractionEnabled:YES];

再次测试。