这是一个不错的例子:NSArray *images = [NSArray arrayWithObjects: [UIImage imageNamed:@"image0.png"], [UIImage imageNamed:@"image1.png"], nil];imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image0.png"]];imageView.animationImages = images;UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];button.bounds = self.imageView.bounds;[button addSubview:self.imageView];[button addTarget:self action:@selector(buttonTouched:) forControlEvents:UIControlEventTouchUpInside];UIBarButtonItem *barButton = [[[UIBarButtonItem alloc] initWithCustomView: button] autorelease];