iphone - Dropping UIImageView conditionally while Dragging -


i working on game i'm allowing user drag , drop image(uiimageview) on target image(uiimageview), , i'm achieving using (cgrectintersectsrect) in touchesended.

now need same in (touchesmoved), checked (cgrectintersectsrect) both images conditionally, if true i'm making both image frames equal , disabling user interaction image, it's indicating image still draggable till (touchesended) called.

i'm using below listed code end dragging in (touchesmoved):

if([self distancebetweenpoint:fruit1.center andpoint:fruit1b.center]<=45) { fruit1.frame = fruit1b.frame; fruit1.userinteractionenabled = false; }

can give me solutions problem?

you can make global bool enddragging , when condition met return touchesmoved.

it works , tested it, won't able move image after condition met.

-(void)touchesmoved:(nsset *)touches withevent:(uievent *)event {  if(enddragging)   return;   //do stuff  } 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -