如何在视图中position (x, y)以UILabel编程方式,最好是从viewDidLoad?该label有Outlet吧,比如myLabel.
Kam*_*had 39
在这里你可以调整位置UILabel.在viewWillAppear方法中,您只需要更改UILabel的原点,如下所示.
CGRect frame = myLabel.frame;
frame.origin.y=10;//pass the Y cordinate
frame.origin.x= 12;//pass the X cordinate
myLabel.frame= frame;
Run Code Online (Sandbox Code Playgroud)
我希望它能让你清楚.
您可以只使用setCenter(x, y).
例如:myLabel.center = CGPointMake(x,y);。
在这里,你只需要在想要把传递点UIlabel内UIView。
| 归档时间: |
|
| 查看次数: |
38147 次 |
| 最近记录: |