1
我正试图将在仪表板应用程序中看到的涟漪效应带给iphone。我的想法是每当我在布局视图中放置一个按钮时,都应该在按钮周围产生波纹效果。 但是,我能够为整个视图带来涟漪效果,但我只需要在按钮周围获得效果。我不知道我出错的地方。我试了下面的代码。动画UIButton图层?
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];
如果我和LayoutView层替换templayer我可以看到从整个视图中riple效果。谁能告诉我该解决方案提前