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?

  1. get dimensions of containing view.
  2. get dimensions of view inserted.
  3. x_position = width_of_containing_view / 2.0 - width_of_inserted_view / 2.0
  4. y_position = height_of_containing_view / 2.0 - height_of_inserted_view / 2.0

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -