Fade In Fade Out Animation

后端 未结 13 1170
生来不讨喜
生来不讨喜 2021-01-30 01:45

Here is some code I struggle with for a while.

If you start the fade in animation, the label text fades in. If I start the fade out animation the the label text fades ou

13条回答
  •  故里飘歌
    2021-01-30 02:04

    The easiest way would be to use:

    [UIView animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion]
    

    and add the fadeOut call to the completion block. The documentation might help answer any questions you have.

    If you can't use the block version for some reason, then you'll have to set a delegate ([UIView setAnimationDelegate:(id)delegate]) and a selector with ([UIView setAnimationDidStopSelector:]) that the delegate will respond to.

    Again, see the documentation for more details.

提交回复
热议问题