iOS - Smooth Color Change Transition/Animation

前端 未结 3 746
不知归路
不知归路 2021-02-07 01:47

I want to have a smooth color transition that goes across the entire spectrum (i.e. red, blue, green, yellow, orange, etc.)

Also want to be able to have smooth transitio

3条回答
  •  没有蜡笔的小新
    2021-02-07 02:41

    Use following code for color transition in iOS, it gives you various configureable options:
    1) Delay before starting animation
    2) Callback on animation completion
    3) Options for animation

    [UIView animateWithDuration:1.0 delay:0.2 options:0 animations:^{
            view.backgroundColor = [UIColor greenColor];
        } completion:^(BOOL finished)
         {
             NSLog(@"Color transformation Completed");
         }];
    

    For Detailed description of different animations please visit:
    UIView Tutorial for iOS: How To Use UIView Animation

提交回复
热议问题