Search code examples
iphoneobjective-ccore-animation

How to make CGFloat using double type in CGRect?


I am doing iPhone development and how to make CGRect return double value? I found there was a macro "#define CGFLOAT_IS_DOUBLE", but how can I change it?


Solution

  • You can't change CGFLOAT_IS_DOUBLE- it is defined in CGBase.h and lets you know the width of CGFloat. In 32-bit apps it will be float, and in 64-bit apps it will be double.

    Do you actually need double precision or could you just use CGFloat everywhere?

    If you do need doubles you'll have to cast, as CVertex says.