import UIKitclass ViewController: UIViewController {
@IBOutlet weak var topY: NSLayoutConstraint!
@IBOutlet weak var destinationBtn: UIButton! override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib. } @IBAction func click(_ sender: UIButton) { UIView.animate(withDuration: , delay: , options: UIViewAnimationOptions.curveEaseInOut, animations: {
self.topY.constant =
self.view.layoutIfNeeded()
}) { (true) in } } override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}}
storyboard中2个按钮,一个点击,一个移动动画用的