如何创建这样的弹跳弹出动画?

Kex*_*Ari 0 objective-c uipopovercontroller ios

我想创建一个像下面那样的动画popover泡泡.使用相同的扩展/收缩反弹动画.有谁知道如何去做?是动画的UIView吗?这是什么动画效果?关于如何解决这个问题的任何指示都将非常感激.谢谢!

在此输入图像描述

Ban*_*ngs 6

你可以使用

OBJ-C:

animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:animations completion: 像这样的方法:

UIView *animationView = [[UIView alloc] initWithFrame:CGRectMake(50, 90, 100, 50)];
animationView.backgroundColor = [UIColor redColor];
animationView.transform = CGAffineTransformMakeScale(0, 0);
[self.view addSubview:animationView];

[UIView animateWithDuration:0.3
                      delay:0
     usingSpringWithDamping:0.5
      initialSpringVelocity:5
                    options:UIViewAnimationOptionCurveEaseInOut
                 animations:^{
                     animationView.transform = CGAffineTransformIdentity;
                 }
                 completion:nil];
Run Code Online (Sandbox Code Playgroud)

迅速:

var animationView: UIView = UIView(frame: CGRectMake(50, 90, 100, 50))
animationView.backgroundColor = UIColor.redColor()
animationView.transform = CGAffineTransformMakeScale(0, 0)
self.view!.addSubview(animationView)
UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 5, options: .CurveEaseInOut, animations: {() -> Void in
    animationView.transform = CGAffineTransformIdentity
}, completion: { _ in })
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述