• AutoLayout面试题记录-用NSLayoutConstraint写动画


    import UIKit
    
    class 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: 1, delay: 0, options: UIViewAnimationOptions.curveEaseInOut, animations: {
                self.topY.constant = 200
                self.view.layoutIfNeeded()
            }) { (true) in
                
            }
            
        }
        
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
    
    
    }

    storyboard中2个按钮,一个点击,一个移动动画用的

    此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935. 我的gitHub: (学习代码都在gitHub) https://github.com/nwgdegitHub/
  • 相关阅读:
    转移阵地啦
    春之感--3月10日
    小鱼儿
    关于时间方法(date和simpledateformat)的实验
    hadoop练习处理地震数据
    出现log4j.properties问题
    远程hadoop集群方法
    小W学物理
    灵知的太阳信仰
    Blue
  • 原文地址:https://www.cnblogs.com/liuw-flexi/p/7522366.html
Copyright © 2020-2023  润新知