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.

No comments: