I have a tag defined in the Storyboard, and I'm trying to change its position based on programs. There are already some existing questions on SO that seem to solve this problem, but none of the solutions work (i.e. the Label does not move). I removed all existing label restrictions to no avail. I tried:
class LandingViewController: UIViewController { @IBOutlet weak var titleLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() titleLabel.frame = CGRectMake(100, 25, titleLabel.frame.size.width, titleLabel.frame.size.height) }
I also tried
titleLabel.center = CGPointMake(120, 150)
instead titleLabel.frame
titleLabel.frame
Did I miss something?
AutoLayout , , translatesAutoresizingMaskIntoConstraints, false, , . , , .
translatesAutoresizingMaskIntoConstraints
false
// , true . , , AutoLayout, , , , , , , .
true
, , , , - AutoLayout. , , .
? , ( , UIlabel )
var tempLabel:UILabel override func viewDidLoad() { super.viewDidLoad() //gets screen frame size var fm: CGRect = UIScreen.mainScreen().bounds //creates a temp UILabel tempLabel = UILabel(frame: CGRectMake(0, fm.frame.size.height, fm.size.width, fm.size.height)) //aligns the UIlabel to center tempLabel.textAlignment = NSTextAlignment.Center //adding UIlabel to view view.addSubview(tempLabel) }
Source: https://habr.com/ru/post/1598603/More articles:GCM curl wait time - androidИнтеграция плагина DataTables с картой django - djangoПравильно ли я понял точку зрения Скотта Мейерса на std:: weak_ptr? - c++Show ANSI colors on Github README.md - githubHow to get angular material color themes - angularjsnet :: ERR_INCOMPLETE_CHUNKED_ENCODING SPRING MVC application using JSP - javaHow can I format a currency with commas and two decimal places? - goAllow TextView to be off-screen - androidC # WPF - Long Click operation - user-interfaceHow to show download icon on Add to Cart Button in Woocommerce - jqueryAll Articles