How to change position of label in swift

Viewed 11114

i had read a lot how to change position of label but i cant do it. Here is my simple code

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var TEKST: UILabel!
    @IBOutlet weak var klik: UIButton!
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.green
        // Do any additional setup after loading the view, typically from a nib.
    }

    @IBAction func kliksad(_ sender: UIButton) {
        if (view.backgroundColor==UIColor.green){
            TEKST.isHidden = false
            TEKST.text = "Hi"
            view.backgroundColor = UIColor.red
            TEKST.frame.size.width = view.frame.size.width
        } else if(view.backgroundColor == UIColor.red) {
            view.backgroundColor=UIColor.green
            TEKST.textColor=UIColor.purple
            TEKST.text = " Hello "
            TEKST.frame.origin = CGPoint(x: 10, y: 50)
            print(TEKST.frame)
        }
    }
}
1 Answers
Related