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 movi开发者_如何学JAVAng 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?
If you mean something similar to the facebook launcher screen, which has arrangeable icons, i recommending taking a look on the three20 framework (which powers the facebook iphone app): http://three20.info
The TTLauncherView (http://three20.info/showcase/launcher) supports reordering and deletion of items, custom column and row counts, and multiple pages of content. It also works on the iPad.
It's amazing how much time it can save you. It's mostly bug-free and ready to use.
look at this post to start with iPhone drag/drop
and this Basic Drag and Drop in iOS
加载中,请稍侯......
精彩评论