Thursday, January 07, 2010

iPhone dev Stupidity 120: Assoc view and it's animation

1. associate view to the animation:

[group setValue:viewForAnimation forKey: kTrashItemAnimation];


2. associate animation to the view:

[viewForAnimation.layer addAnimation:group forKey:@"savingAnimation"];


later in the animation did stop callback, we can get the view from the animation ended to do more works based on different views.

iPhone dev Stupidity 119: Table row deletion order

You need to delete the row in the data model first. Then you can delete it in the UITableView.

For UITableView will check the sanity of the data model when deleting rows, there'll be an error if the sanity check fails.

Tuesday, January 05, 2010

iPhone dev Stupidity 118: How to animate a UIBarButtonItem

1. The animation
 You need to setup a UIBarButtonItem with customView. That could be a UIImageView. The fire a timer to call toolbar's setItems:animated: method.

2. How to get those animation images?

The Other.artwork file is in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/ (you need the SDK).
Use the "iPhoneShop-1.3.jar" program -- available currently here to extract all of the images into a directory.

    java -jar iPhoneShop-1.3.jar ARTWORK Other.artwork EXPORT Other

* A single fact: 

The trashing animation of iPhoto takes 15 frames to open the trash bin and another 16 frames to close it.

Sunday, January 03, 2010

iPhone dev Stupidity 117: Animation along curved path

From stackoverflow:


The best way to handle this is to use Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation.