UIView带水效果

use*_*201 2 iphone ios5 quartz-core

我正在制作一个基于视图的应用程序,我希望为视图提供水效果.请帮我.

我正在使用以下代码

[UIView beginAnimations:@"rippleEffect" context:NULL]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationTransition:(UIViewAnimationTransition)110 forView:view cache:NO]; 
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

Nit*_*hel 6

您可以设置浏览WaterEffect通过点击按钮,我只是谷歌它,我得到了答案FROM

  • 首先你需要QuartzCore.framework在Tar​​get-> Build Phases-> link Binary中添加你的Project,库点击+按钮.

  • #import <QuartzCore/QuartzCore.h> 在.m文件中

现在实现这个BUTTON的IBAction

-(IBAction)btnActionTapped:(id)sender{
    CATransition *animation=[CATransition animation];
    [animation setDelegate:self];
    [animation setDuration:1.75];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:@"rippleEffect"];

    [animation setFillMode:kCAFillModeRemoved];
    animation.endProgress=0.99;
    [animation setRemovedOnCompletion:NO];
    [self.view.layer addAnimation:animation forKey:nil];
}
Run Code Online (Sandbox Code Playgroud)