sivakumar
sivakumar

Reputation: 21

Animating the UIButton Layer?

I'm trying to bring the ripple effect seen in the dashboard application to iphone. My idea is whenever i place a button in the layout view there should be ripple effect around the button. However, I`m able to bring the ripple effect for the whole view but I needs the effect only around the button. I don know where I went wrong. I tried the following code.

LayoutButton *tempLayoutButton=[[LayoutButton alloc] initWithObject:object];
tempLayoutButton.center=copyImage.center;
[layoutView addSubview:tempLayoutButton];  
CALayer *templayer=[CALayer layer];
tempLayoutButton.layer.masksToBounds=NO;
templayer.frame=CGRectMake(0,0,50,50);
[tempLayoutButton.layer addSublayer:templayer];

CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 1.0f;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.type = @"rippleEffect";
[templayer  addAnimation:animation forKey:@"animation"];
[tempLayoutButton release];
[tempLayoutButton.layer addSublayer:templayer];

If I replace templayer with LayoutView layer I can see the riple effect from the whole view. Can anyone tell me the solution

Thanks in advance

Upvotes: 1

Views: 619

Answers (1)

sivakumar
sivakumar

Reputation: 21

I found the answer in one of apples mailing list. The animation is apple`s own animation and no one can use that. And there is no guarantee for the animation to appear properly in the screen. If we need the same type of animation we need to manipulate the layers and get the animation

Upvotes: 1

Related Questions