ios - When setting the frame of a UILabel, is it possible to set it to the vertical and horizontal center of the superview in code? -
like, cgrectmake()
, have specify center, both horizontally , vertically?
- get dimensions of containing view.
- get dimensions of view inserted.
- x_position = width_of_containing_view / 2.0 - width_of_inserted_view / 2.0
- y_position = height_of_containing_view / 2.0 - height_of_inserted_view / 2.0
Comments
Post a Comment