0
每当“_currentField”(它是一个带有数字格式化程序的文本字段)的值大于或等于1000时,我希望显示“_congrats”(它是一个面板)我想要“_errormsg”(另一个面板)显示出来。每次输入任何值时,弹出的唯一内容就是“_errormsg”。我究竟做错了什么?如果语句工作不正常
- (void)onTimer:(NSTimer*)aTimer {
if ([_currentField.stringValue integerValue] >= 1000)
{
[_congrats orderFront:(id)self];
[_progIndicator stopAnimation:(id)self];
}
else {
[_errormsg orderFront:(id)self];
[_progIndicator stopAnimation:(id)self];
}
}
什么类是currentField? – 2012-07-15 21:21:42
对不起!我应该提到这一点。它是一个文本字段。 – Johnny 2012-07-15 21:22:47
输入的号码是怎样的?例如,如果用逗号输入“1,000”,那么解析器可能不够聪明,不能将其视为数字,它将返回零。 – 2012-07-15 21:26:28