【问题标题】:How to create custom UIViewAnimation如何创建自定义 UIView 动画
【发布时间】:2013-03-25 23:37:30
【问题描述】:

创建自定义 UIView 动画过渡的最简单方法是什么?在 Google 搜索中弹出的大多数教程都不是最新的。 (我使用的是 XCode 4.5 版本)在我当前的 iPhone 应用程序中,我的屏幕转换有以下代码:

[UIView beginAnimations:@"View flip" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.25];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view                            cache:YES];    
[UIView commitAnimations];

我想要一些独特的东西,而不是 5 或 6 个内置过渡。关于从哪里开始有什么想法或建议吗?

【问题讨论】:

  • 首先,不要使用旧方法,例如您在问题中显示的方法。使用基于块的方法。

标签: ios xcode uiview xcode4.5 uiviewanimation


【解决方案1】:

我想这就是你要找的东西:

[UIView animateWithDuration:0.3 animations:^{
    //Move frame or transform view
}];

在该块中,您可以放置​​任意动画代码。

【讨论】:

  • 非常好!我会从这里出去玩!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-20
  • 1970-01-01
相关资源
最近更新 更多