【问题标题】:UIView with water effects带水效果的 UIView
【发布时间】:2013-01-17 10:46:31
【问题描述】:

我正在制作一个基于视图的应用程序,我希望在其中为视图赋予水效果。 请帮帮我。

我正在使用以下代码

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

【问题讨论】:

  • 你必须尝试什么???
  • 我试图产生连锁反应,但那不起作用
  • [UIView beginAnimations:@"rippleEffect" context:NULL]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:(UIViewAnimationTransition)110 forView:view cache:NO]; [UIView 提交动画];
  • 用您的代码编辑您的问题,以便所有开发人员都可以看到它......并帮助您:)
  • 嘿 @user1926201 试试我的回答,如果你愿意,它可以帮助你,而你的 UIView 加载这个效果触发了你刚刚用[self btnActionTapped:self];调用这个 IBAction@

标签: iphone ios5 quartz-core


【解决方案1】:

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

  • 首先,您需要在您的项目中添加QuartzCore.framework,从 Target->Build Phases-> link Binary with library 点击 + 按钮。

  • #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];
}

【讨论】:

  • 是的,它正在工作。但是,你应该说这是一个私有 API
  • 有没有可能一旦我们点击按钮,效果就会永远保持下去
  • “私有 API”有什么问题?
  • 私有 API 没有任何问题。但是,如果您不知道 API 是什么.....
猜你喜欢
  • 2017-01-23
  • 2013-07-25
  • 1970-01-01
  • 2012-01-28
  • 1970-01-01
  • 2011-01-04
  • 1970-01-01
  • 1970-01-01
  • 2016-02-06
相关资源
最近更新 更多