【问题标题】:Can't move a UILabel position无法移动 UILabel 位置
【发布时间】:2012-11-13 21:53:13
【问题描述】:

我知道,这是一个愚蠢的愚蠢问题,但是在一天尝试了我所看到的所有搜索之后,我无法移动 UILabel,代码是这个:

CGRect frame = self.label_total.frame;
frame.origin.x = 500; // new x coordinate
frame.origin.y = 500; // new y coordinate
self.label_total.frame = frame;

如果我将它放在 IBAction 中它可以工作,但我想将它插入到 viewDidLoad 中,但它不起作用。请帮帮我。

【问题讨论】:

    标签: uilabel move cgrect


    【解决方案1】:

    试试这个稍加修改的代码。 必须提供标签的出口。

    CGRect frame1 = lbl_total.frame   ;
    frame1.origin.x = 500; // new x coordinate
    frame1.origin.y = 500; // new y coordinate
    lbl_total.frame= frame1;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多