How can I make the buttons in an application draggable and droppable just like in OS' home screen?
So far I see two ways to animate stuff –
- By
UIViewmethods which provide animation forframe,bounds,centre,transformandalpha - By using
Core Animation, which I'm not familiar with.
I was able to move a UIImageView object. Will the same apply for moving a UIButton object?
My code for moving a UIImageView object is:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
imageView.center = location;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}
Can I use this same code for moving the button?