objective c - iOS continuous fade-out and fade-in animation -


in objective-c, want add fade in , fade out animation uiview. want fade-out , fade-in animation continuously. illustrate it, effect want have following:

fade out - fade in - fade out - fade in - ...

what i'm trying following:

-(void)fadeoutin:(uiview *)view duration:(nstimeinterval)duration {     static cgfloat alpha = 1.0;     [uiview animatewithduration:duration                           delay:0.0                         options: uiviewanimationoptionrepeat| uiviewanimationoptioncurveeaseinout                      animations:^{                          alpha = abs((int)(alpha - 1.0));                          view.alpha = alpha;                      }                      completion:^(bool finished){                      }]; } 

i tried following:

-(void)fadeoutin:(uiview *)view duration:(nstimeinterval)duration {     [uiview animatewithduration:duration                           delay:0.0                         options: uiviewanimationoptionrepeat| uiviewanimationoptioncurveeaseinout                      animations:^{                          view.alpha = 0.0;                      }                      completion:^(bool finished){                           [uiview animatewithduration:duration                                                delay:0.0                                              options: uiviewanimationoptionrepeat|uiviewanimationoptioncurveeaseinout                                           animations:^{                                               view.alpha = 1.0;                                           }                                           completion:^(bool finished){                                            }];                      }]; } 

but issue worked same, i.e., uiview fade out , suddenly show up(not fade in), fade out again...

seems fade in animation not work @ all. know what's wrong of code please? suggestion highly appreciated.

try this

    [uiview animatekeyframeswithduration:1 delay:0 options:uiviewanimationoptionrepeat|uiviewanimationoptionautoreverse|uiviewanimationcurveeaseinout animations:^{     self.customiv.alpha = 0; } completion:^(bool finished) { }]; 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -