Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class ViewController: UIViewController {
- @IBOutlet weak var stackOutlet: UIStackView!
- @IBOutlet weak var buttonOutlet: UIButton!
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- @IBAction func buttonAction(_ sender: AnyObject) {
- let newView = UIView(frame: CGRect(x: 0, y: 0, width: 240, height: 128))
- newView.backgroundColor = UIColor.green
- self.stackOutlet.insertArrangedSubview(newView, at: 1)
- UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseInOut, animations: {
- newView.heightAnchor.constraint(equalToConstant: 128).isActive = true
- newView.widthAnchor.constraint(equalToConstant: 240).isActive = true
- self.view.layoutIfNeeded()
- }, completion:
- { finished in
- print("OKKK")
- })
- print(stackOutlet.subviews.count)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement