我有2个意见。这个想法是从第二个视图中选择图像并将其放在第一个视图上。
问题是我试图添加平移手势,它没有响应或没有调用该方法。请帮忙。谢谢

我的第一个视图中的代码

- (void)newStampImage: (UIImage *)inImage
{
    stampImageView = [[UIImageView alloc]initWithImage:inImage];
    UIPanGestureRecognizer *stampPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(moveStamp:)];
    [stampPanGesture setMinimumNumberOfTouches:1];
    [stampPanGesture setMaximumNumberOfTouches:1];
    [stampImageView addGestureRecognizer:stampPanGesture];
    stampImageView.center = self.view.center;
    [self.view addSubview:stampImageView];
}

最佳答案

请加

stampImageView.userInteractionEnabled = YES;

10-08 05:15