gpt4 book ai didi

iphone - 如何为 ImageView 数组中的三个 ImageView 添加 UIPanGestureRecognizer?

转载 作者:行者123 更新时间:2023-11-28 22:35:17 25 4
gpt4 key购买 nike

截图:

enter image description here

我正在将 uipangesture 添加到 uimageviews 数组,如以下代码所示,但我只想将 uipangesture 添加到棕色、绿色和粉红色 ImageView 。

如何在循环中执行此操作?最终我只想在空 ImageView 周围平移三个 ImageView 。

for(int i=0; i<[imageViewArray count]; i++) {

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panAction:)];

[[imageViewArray objectAtIndex:i]addGestureRecognizer:panGesture];}
}

最佳答案

一个。为要添加平移手势的那些 ImageView 的标签值分配一个数字。

B.在您的 for 循环中,检查具有此标记值的 ImageView 并添加平移手势识别器。

关于iphone - 如何为 ImageView 数组中的三个 ImageView 添加 UIPanGestureRecognizer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16249211/

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