2013-01-17 47 views
2

我正在製作一個基於視圖的應用程序,我希望給水景效果。 請幫幫我。UIView水效果

我使用下面的代碼

[UIView beginAnimations:@"rippleEffect" context:NULL]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationTransition:(UIViewAnimationTransition)110 forView:view cache:NO]; 
[UIView commitAnimations]; 
+0

這個IBAction爲你不得不嘗試??? – iPatel

+0

我試着給連鎖反應但那不是工作 – user1926201

+0

認罪把代碼在這裏:) – iPatel

回答

6

您可以通過點擊按鈕,我只是谷歌將其設置查看WaterEffect我得到了答案FROM

  • 首先,你需要在你的項目中加入QuartzCore.framework目標 - >構建階段 - >鏈接二進制與庫點擊+按鈕。

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

現在實現BUTTON

-(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]; 
} 
+0

是的,它正在工作。但是,您應該說這是一個私人API – medvedNick

+0

是否有可能一旦我們單擊該按鈕,該效果將永遠保留 – user1926201

+0

「私有API」有什麼問題? – Agat