iPhone position of a subview?

Ian Vink picture Ian Vink · Jan 18, 2010 · Viewed 8.7k times · Source

I add a view dynamically, but when it appears on the form, it's in the upper left hand corner.

Where do I set the X and Y of the new subview?

Answer

Philippe Leybaert picture Philippe Leybaert · Jan 18, 2010

You should set the frame property:

myView.frame = CGRectMake(10,10,200,100);

This will position the view at location (10,10), with a size of 200x100