iPhone trash can suck animation
I am trying to use the trash can animation in an iPhone application I am building. I know the feature I need help with is a private API but the app will be in-house.
According to the iPhoneDevWiki at the toolbar page you can activate the trash can opening animation using [UIToolbar animateToolbarItemIndex:duration:target:didFinishSelector:];
.
After countless hours trying to use this method I could not get it to work. I have changed it so far to the following: [toolbar animat开发者_开发问答eToolbarItemIndex:1 duration:1.0 target:self didFinishSelector:@selector(done:)];
.
toolbar
is the name of the UIToolbar
I created programically using CGRectMake
.
My button image for the trash can is 1, since it is the second button.
I have tried putting self
and nil
in target
but it doesn't work.
didFinishSelector
just links to -(void)done:(id)sender;
.
If I change the animateToolbarItemIndex
to something that does not exist, the console says that it does not exist. Any ideas to what I have wrong?
The trash can animation works with an array of images, each with the lid closing/opening a little more. So you'd do something like this:
UIImageView* trashCan = [[UIImageView alloc] initWithFrame:self.view.frame];
trashCan.animationImages = [NSArray arrayWithObjects:UIIMAGES, nil];
trashCan.animationDuration = 1.00;
trashCan.animationRepeatCount = 1;
[trashCan startAnimating];
[self.view addSubview:trashCan];
If you have a google I'm sure you'll be able to find the trash can images to use.
精彩评论