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);
精彩评论