I am trying to make a UIImageView
blink upon viewDidLoad
. I am not sure what the best way to do this is. I've tried using loops with .hidden=YES
and .hidden=NO
but this seems like a bad way to do this. I need some proper advice.
try this :
-(void)blink:(UIView*)view count:(int) count
{
if(count == 0)
{
return;
}
[UIView animateWithDuration:0.2 animations:^{
view.alpha = 0.0;
} completion:^(BOOL finished){
[UIView animateWithDuration:0.2 animations:^{
view.alpha = 1.0;
} completion:^(BOOL finished){
[self blink:view count:count-1];
}];
}];
}
or if you want it to blink forever try this :
-(void)blinkForever:(UIView*)view
{
[UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat animations:^{
view.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