PDA

View Full Version : Can I programatically move a control?




scooterf
Apr 12, 2009, 08:51 PM
Suppose I have a UIButton...can I programatically change the x and y locations of the button on the screen? What would the property be? New to this....

Thanks



iphonedevelop18
Apr 12, 2009, 10:51 PM
watch this (http://icodeblog.com/2008/10/28/iphone-programming-tutorial-animating-a-ball-using-an-nstimer/) tutorial, it should give you a general idea of grabbing the x and y values of an object in the code and play around with it a little.

firewood
Apr 12, 2009, 10:53 PM
Yes. You can even animate the movement.

To find the relevant property, just read the definition and reference for UIButton, and follow the chain of whatever classes it inherits from. All built into XCode.

o

scooterf
Apr 13, 2009, 06:38 AM
that tutorial is perfect. Thanks.