我已經通過很多教程了在屏幕上拖動圖像使用touchesmoved方法 但拖動態創建的UIImageView他們大多不是用於動態創建imageviews如何在OBJ C(Xcode中)
在項目中,我創建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];
}
提前感謝好答覆
我有嘗試了上面更正的代碼>>只有for循環內部的行>>但還沒有工作 – 2013-02-14 13:01:31
你只嘗試了代碼裏面for(int i = 0; i
2013-02-14 13:03:54
我已經使用touchesmoved方法,但程序無法進入所需的活動>> 告訴我self.elements代碼的目的以及在哪裏添加此? – 2013-02-14 13:06:08