Serge
Serge

Reputation: 2129

I can't animate UIView's border color

I try to make fade in/out effect for UIView border but it does'nt work. When try to do the following effect for background color it works perfectly. Here is a code I developed:

[UIView animateWithDuration:3.0f 
             animations:^ {

                 [UIView beginAnimations:nil context:nil];
                 [UIView setAnimationDuration:0.5];
                 self.layer.borderColor = [[UIColor redColor] CGColor];
                 self.layer.borderWidth = 1.5f;
                 [UIView commitAnimations];
             } 
             completion:^(BOOL finished){

                 [UIView beginAnimations:nil context:nil];
                 [UIView setAnimationDuration:0.8];
                 self.layer.borderColor = [[UIColor whiteColor] CGColor];
                 self.layer.borderWidth = 1.5f;
                 [UIView commitAnimations];
             }];

Upvotes: 1

Views: 1896

Answers (1)

Robert Atkins
Robert Atkins

Reputation: 24688

According to the answer to my question you can't animate CALayer properties in a UIView block.

Upvotes: 5

Related Questions