gpt4 book ai didi

ios - UIImageView 不响应 UIPanGestureRecognizer 手势

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:53:40 25 4
gpt4 key购买 nike

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

我的第一个 View 中的代码

- (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;

关于ios - UIImageView 不响应 UIPanGestureRecognizer 手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9391038/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com