Silver challenge: fade out animation


#1

I didn’t like how the image just disappeared, so I wanted it to fade out. I tried starting the animation then clearing the image out, but clearing the image immediately screws up the animation. I ended up using UIView’s animateWithDuration:animations:completion: and that works to my satisfaction. To clear the image, I delete the image from the store, the key from the BNRItem, and the image from the ImageView. Can anyone think of other things that need to be cleared?

- (IBAction)clearPicture:(id)sender { // Fade out image, then clear image from existence [UIView animateWithDuration:0.3f animations:^{ imageView.alpha = 0.0f; } completion:^(BOOL finished){ [[BNRImageStore sharedStore] deleteImageForKey:[item imageKey]]; [item setImageKey:nil]; [imageView setImage:nil]; }]; }