【发布时间】:2012-01-24 22:07:16
【问题描述】:
当我尝试比较两个 UIColors 的 RGB 分量时收到此警告
在 .h 文件中,我声明了这一点
-(int) ColorDiff:(UIColor *) color1 :(UIColor *)color2;
在 .m 文件中
- (int) ColorDiff:(UIColor *) color1 :(UIColor *)color2{
... //get RGB components from color1& color2
// compute differences of red, green, and blue values
CGFloat red = red1 - red2;
CGFloat green = green1 - green2;
CGFloat blue = blue1 - blue2;
// return sum of squared differences
return (abs(red) + abs(green) + abs(blue));
}
然后在同一个 .m 文件中,我像这样比较 2 个 UIColors
int d= ColorDiff(C1,C2);// I got the warning right here.
我做了研究,人们说我必须包含头文件。我这样做了,但对我的情况没有帮助。 为什么会出现此错误?
【问题讨论】:
标签: ios gcc-warning