In my iPad app I need to display cover-Images of publications. The user can tap on a cover to get details.
I thought about rendering UIButtons as custom buttons with the cover image as Background-image. Is it possible to fade UIButtons in and out? The user can choose a category of publications to be displayed, and ih he changes the category I wanted to fade some publications out.
The alpha
property of any UIView
(which includes a UIButton
) can be animated using the block-based animations method:
[UIView animateWithDuration:0.25 animations:^{myButton.alpha = 0.0;}];
This will fade your button out over a 0.25 second period. Set the alpha
to 1.0 to fade it back in again.
If you want the button to respond to events while it's animating, make sure to enable user interaction
[UIView
animateWithDuration:5.0
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{ button.alpha = 0.0; }
completion:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With