【发布时间】:2015-07-31 12:54:02
【问题描述】:
在我的 CGFloat 包装器中,我收到错误 Returning CGFloat (aka Double) from a function result type CGfloat aka double take the address with &
+(CGFloat*)pointData;
//
+(CGFloat *)pointData{
NSInteger savedInt = [[NSUserDefaults standardUserDefaults] integerForKey:@"savedPointForText"];
CGFloat textPoint = (CGFloat)savedInt;
if(textPoint <1) {
textPoint = 18.0;
}
return textPoint;
}
如果我这样做return &textPoint;,我会收到一个警告,即返回带有局部变量“textpoint”的堆栈内存地址
【问题讨论】:
-
+(CGFloat)pointData;没有“*”? -
是的,谢谢
标签: ios objective-c cgfloat