开发者

How to make CGFloat using double type in CGRect?

I am d开发者_StackOverflowoing 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?


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.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜