【问题标题】:How to create an animation like in Facebook Pages top menu?如何在 Facebook 页面顶部菜单中创建动画?
【发布时间】:2015-04-17 23:57:43
【问题描述】:

在 facebook 的一个新应用程序 Pages 中,当您向下滑动时,菜单会出现在顶部。我正在尝试做的动画是当您点击设置按钮时的动画,即每个单元格一次向左移动一个,但非常流畅。在 Objective C 中不使用 Facebook 的 pop 引擎如何实现这样的动画?

【问题讨论】:

    标签: ios objective-c facebook animation facebook-pop


    【解决方案1】:

    请记住,每个单元格都可能是 UIView 的自定义子类(即不是 UITableViewCell 或其他苹果类),因此您必须仔细设计您的 UI。

    但是,使用UIView 类可以轻松实现动画。 Apple's documentation 是开始学习动画的好地方。

    你想要的是这样的:

    NSTimeInterval delay = 0.2;
    for (UIView *myView in myViewArray) {
        [UIView animateWithDuration:0.5 delay:delay options:UIViewAnimationOptionCurveEaseInOut animations:^{
           /*
            * This is where you set the properties you want to animate.
            * If you're using AutoLayout (i.e. NSLayoutConstraint) you need to set the constant property of the relevant constraint, not the view's frame property.
            */
        } completion:nil];
        delay += 0.2;
    }
    

    这将为您提供一个接一个发生的动画(相隔 0.2 秒)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-13
      • 1970-01-01
      • 2021-04-04
      • 1970-01-01
      • 2013-08-22
      • 2012-05-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多