objective c - Swap positions UIImageViews second time Xcode -
i have problem. when use code below, can swap same uiimageviews first time. second time, go original position or overlay each other.
example code:
if (cgrectintersectsrect(view1.frame, view2.frame)) { [uiview animatewithduration:0.2 animations:^{ cgrect view1frame = view1.frame; view1.frame = view2.frame; view2.frame = view1frame; }]; }
how can swap positions of uiimageviews every time? appreciated!
did make method?
-(void) swaplocwith: (uiview *) view1 and: (uiview *) view2 { //your code sample here } ... -(void) somemethod { //swap once [self swaplocwith: view1 and: view2]; //swap [self swaplocwith: view2 and: view1]; }
Comments
Post a Comment