开发者

Setting TextLabel Position Objective-c

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开发者_StackOverflow中文版 = 540;


Use the frame property to set it relative to the superview's coordinates like this:

myTextLabel.frame = CGRectMake(x, y, width, height);

There is no textlabel but I assume you mean either UITextField or UILabel, either way both inherit from UIView and have the frame property.


You could also move it according to the object's center.

float x = 220; //Change This Number
float y = 180; //Change This Number

myTextField.center = CGPointMake(x,y);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜