views:

145

answers:

2

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?

A: 

Wrap the CGRect or create helper methods that just do casting?

double d= (double)rect.size.height;

floats perform better on the iphone (I think)

CVertex
It was said the marco defined what type CGFloat used, but I don't know how to change it
Mickey Shine
+1  A: 

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.

sbooth
Im just looking for a bug in my app. Thank you very much~
Mickey Shine