Xcode无法识别

时间:2012-03-17 14:33:02

标签: objective-c

我正在尝试使用以下方法格式化数字。在“NsNumberFormatter”中可用但Xcode无法识别这些方法。它显示错误为 “例如消息的接收器类型'NSNumberFormatter'没有声明带有选择器'setHasThousandSeparators'的方法。第二种方法也出现相同的错误

setHasThousadSeparators: 
setThousandSeparator:

 currentVal = [currentVal stringByAppendingString:str];
        NSLog(@"Current Val is %@",currentVal);
        NSNumberFormatter * myNumFormatter = [[NSNumberFormatter alloc] init];

        [myNumFormatter setThousandseparator:@","];
        NSNumber *tempNum = [myNumFormatter numberFromString:currentVal];
        NSLog(@"My number is %@",tempNum);

        [display setText:[myNumFormatter stringFromNumber:tempNum]];
        currentVal=display.text;

1 个答案:

答案 0 :(得分:0)

[myNumFormatter setThousandseparator:@“,”];

你没有正确地大写。见“s”。应该是“S”。