I am having two UIButtons(button1 and button2) of two different frames, the thing is I want to drag the button2 on to the button1 so that the button2 is repositioned to button1 position, and button2 should occupy button1 position.
Guy's I need ur help and ideas how can I do with it.
Thanks to all, Monish
CGRect rect = btn.frame;
btn.frame = btn2.frame;
btn2.frame = rect;
If you want to animate this, start with reading this
Is it what you are asking for?
You need to change the button's x-axis in frame and use animations to show it as its moving (if you want) accordingly.
[buttonOutletName setFrame:CGRectMake(old_xCoordinate, yCoordinate, width, height)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1.0];
[buttonOutletName setFrame:CGRectMake(new_xCoordinate, yCoordinate, width, height)];
[UIView commitAnimations];
If helpful please mark:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.