Is there a quick way to position a ui control (such as bottom center or top center)? Right now I routinely set the frame of the UIcontrol or UIView subclass to position them but would like to know if I can avoid doing calculation just to centralize a control.
A:
You can set a view's center property to the center property of the parent if you want it centered. That does not set it's width and height though.
drvdijk
2009-07-01 09:10:00
A:
No, iPhone OS only supports "Struts and Springs" layout.
But you could easily create category methods that do this for you:
- (void)positionAtTopCenterOfSuperView;
- (void)positionAtCenterOfSuperView;
- (void)positionAtBottomCenterOfSuperView;
These are pretty trivial to write, but will save you time in the future. In fact I think I might make this category myself.
Corey Floyd
2009-07-01 09:29:04