Why are UIView frames made up of floats?

前端 未结 3 1361
伪装坚强ぢ
伪装坚强ぢ 2021-01-15 05:13

Technically the x, y, width, and height represent a set of dimensions that relate to pixels. I can\'t have 200.23422 pixels so why do they use floats instead of ints?

3条回答
  •  清酒与你
    2021-01-15 05:20

    The dimensions are actually points that on non-retina screens have a 1 to 1 relation to pixels, but for retina screens 1 point = 2 pixels. So on a retina screen you can actually increment by half a point.

提交回复
热议问题