【发布时间】:2013-02-14 12:34:01
【问题描述】:
我已经阅读了许多教程来使用 touchesmoved 方法在屏幕上拖动图像 但其中大部分不适用于动态创建的图像视图
在我的项目中,我以编程方式创建了 5 个 UIImageview,
现在我希望用户可以将它们拖到屏幕上>>我也按照这个答案 Question 但一切都是徒劳的,到目前为止没有成功>
动态创建imageview的代码是
for (int i = 0; i < index ; i++)
{
UIImageView *imageView1 = [[UIImageView alloc] initWithImage:
[UIImageimageNamed:image_name]];
self.imageView1.userInteractionEnabled = YES;
imageView1.frame = CGRectMake(xvalue, yvalue, 80.0f, 80.0f);
self.view.userInteractionEnabled = YES;
[self.view addSubview:imageView1];
}
提前感谢您的好评
【问题讨论】:
标签: ios objective-c xcode drag-and-drop uiimageview