【问题标题】:iPhone animation that grows from corner从角落长出的 iPhone 动画
【发布时间】:2014-01-23 17:31:50
【问题描述】:

我想创建一个动画,当我点击 GMSmarker 时,uiview 将从给定控件/图像的左角或右角出现并具有增长效果,并将标记包含在它的角落(图像显示最终结果)

我知道如何创建XIB和相关的UIView,以及将它们添加到ViewController,我该如何做动画部分?

【问题讨论】:

    标签: objective-c animation uiview


    【解决方案1】:

    你知道视图的起始帧...

    CGRect startFrame = CGRectMake(pin.x, pin.y, 0, 0);
    

    你知道视图的结束帧...

    CGFloat height = 100;
    CGFloat width = 100;
    
    CGRect endFrame = CGRectMake(pin.x, pin.y - height, width, height);
    

    所以你可以动画它...

    theView.frame = startFrame;
    
    [UIView animateWithDuration:1.0 animations:^(){
        theView.frame = endFrame;
    }];
    

    这将从左下角动画出来。

    【讨论】:

      猜你喜欢
      • 2017-12-16
      • 1970-01-01
      • 2011-11-23
      • 2014-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      相关资源
      最近更新 更多