views:

15

answers:

1

Hi Im 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 Im able to bring the ripple effect for the whole view but I needs the effect only around the button. I tried the following code. I don know where i went wrong. Can someone help me. Below is the code I used

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 fro the whole view. Can anyone tell me the solution

Thanks in advance