设置 TextLabel 位置 Objective-c
我有一个滚动视图,其中有许多对象,因为我无法在 InterfaceBuilder 中编辑滚动视图上的位置,我如何通过编程设置对象的位置? 像这样的东西:
myTextField.x = 50;
myTextField.y = 540;
I have a Scroll View with many objects in it,since i cant edit the position on scrollview in InterfaceBuilder,how i set the position of the object programmactily?
Something like:
myTextField.x = 50;
myTextField.y = 540;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用框架属性将其设置为相对于超级视图的坐标,如下所示:
没有文本标签,但我假设您的意思是
UITextField
或UILabel
,无论哪种方式都继承自UIView
并具有框架属性。Use the frame property to set it relative to the superview's coordinates like this:
There is no textlabel but I assume you mean either
UITextField
orUILabel
, either way both inherit fromUIView
and have the frame property.您还可以根据对象的中心移动它。
You could also move it according to the object's center.