File this one under “obvious once you think of it”: if you want to have a UIButton with some kind of animation effect, but that seems complicated since a UIButton can only have a single image specified; well then as described here, just create an animatable UIImageView,
NSArray *images = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image0.png"],
[UIImage imageNamed:@"image1.png"],
nil];
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image0.png"]];
imageView.animationImages = images;
then add it as a subview of a custom button!
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.bounds = self.imageView.bounds;
Which can then be made into a UIBarButtonItem if you like,
UIBarButtonItem *barButton = [[[UIBarButtonItem alloc] initWithCustomView: button] autorelease];
And then just call [imageView startAnimating]
to get your pretty pulsating or whatever action going.
JUN