D-N*_*ice 2 iphone objective-c iphone-sdk-3.0
我将接收的十六进制颜色值作为字符串并将其转换为int,以便我可以获得正确的十六进制值.我的导入下面有以下代码:
@implementation NSString (HexIntValue)
- (unsigned int)hexIntValue
{
NSScanner *scanner;
unsigned int result;
scanner = [NSScanner scannerWithString: self];
[scanner scanHexInt: &result];
return result;
}
@end
Run Code Online (Sandbox Code Playgroud)
然后在这里调用函数:
unsigned int x = (int)[globalBGColor hexIntValue];
Run Code Online (Sandbox Code Playgroud)
一切正常,但我真的想摆脱警告,因为我或多或少准备提交我的应用程序.
谢谢!