我正在尝试使用Objective-C编写的代码确定两种颜色是否相同.
我正在使用这段代码来确定这两种颜色是否相同(目前用于调试目的)
NSLog(@"currentColor is %@", currentColor);
NSLog(@"Adjacent Color is %@",[[buttonArray objectAtIndex:1] backgroundColor]);
NSLog(@"%i",[[buttonArray objectAtIndex:1] backgroundColor]==currentColor);
Run Code Online (Sandbox Code Playgroud)
我的控制台正在显示
2009-10-20 00:27:10.814 colorGame[13588:207] currentColor is kCGColorSpaceModelRGB 0 0 1 1
2009-10-20 00:27:10.815 colorGame[13588:207] Adjacent Color is kCGColorSpaceModelRGB 0 0 1 1
2009-10-20 00:27:10.815 colorGame[13588:207] 0
Run Code Online (Sandbox Code Playgroud)
如果被问到我可以发布更多代码(我不知道是否真的有必要).当前颜色最初定义为
UIColor *currentColor;
Run Code Online (Sandbox Code Playgroud)
如果这是任何帮助.
我很确定我只是做比较错误,并且可能有一些可以比较颜色的内置方法,我只是不知道.