Is there a constant for the maximum CGFloat value?

前端 未结 8 766
滥情空心
滥情空心 2021-02-02 05:09

I need to create a CGSize to compute text height of an arbitrary text with arbitrary length. UIKit has this nice method -sizeWithFont:constrainedToSize: and my text is only cons

8条回答
  •  一整个雨季
    2021-02-02 05:59

    A CGFloat is just a float so you can safely use FLT_MAX from .

    EDIT: As others have now pointed out it looks like CGFLOAT_MAX is already defined for you so you should use that for consistency rather than FLT_MAX, even though they are the same thing on 32 bit platforms.

提交回复
热议问题