How to create iPhone ios4 folder effect with objective-c
anyone can give me any hint to recreate the iPhone ios4 folder effect? I开发者_开发百科'd like to implement that in my iPhone App. Thanks
Hmmm -- Off the top of my head (not at all final/fully developed idea):
You have a few options here to handle the interactions - but first off you will need to look at CATransforms and UIView Animations - they will be essential in animating the scaling and translating of your views.
With the interactions, might I suggest using UIGestureRecognizers - they provide a great base of interaction (singleTouch, doubleFingerTouch, Tap, Pan, Pinch, swipe, Rotate etc) - you can set number of touches/taps required as well.
The general setup would be to apply a pan recognizer to your views - then possibly have a timer that counts how long a view has been hovered over another - or have a certain region where a pan actives on another view. Then you would animate a UIView to replicate the opening of the folder (tell the view to scale vertically or similar), add the subviews (title field, current objects inside the folder etc) -- then when you release the view being panned you would animate it to scale down into the folder.
A nice idea would be to store folder information using CoreData too (then you can easily re-load folders and alter them etc).
Just an idea,
Feel free to ask specific questions about animating views - I have been working in the area a fair bit in the recent weeks.
Best regards,
Michael
精彩评论