I am trying to apply Drag and Drop function on different images that i have but my code isn’t working, it has no effect on the images on my view.
Here’s my code:
if([touch view]==imageOne){
CGPoint location=[touch locationInView:self.view];
imageOne.center=location;
return;
}
if([touch view]==imageTwo){
CGPoint location=[touch locationInView:self.view];
imageTwo.center=location;
return;
}
if([touch view]==imageThree){
CGPoint location=[touch locationInView:self.view];
imeageThree.center=location;
return;
}
if([touch view]==imageFour){
CGPoint location=[touch locationInView:self.view];
imageFour.center=location;
return;
}
if([touch view]==imageFive){
CGPoint location=[touch locationInView:self.view];
imageFive.center=location;
return;
}
Set
userInteractionEnabledproperty of UIImageView toYES. By default it will beNO. For more info, see Apple documentation