我试图从Abacus游戏,iphone 5s和iphone 6上获得数十亿和百万的价值,它正确地给我价值,但在iphone 4s和iphone 5上它给我的负值格式,我试用了数据类型长,长,但仍然没有给我正确的值这里是我的代码在iphone 5s和6上工作正常,但给出警告并给出减号格式的数字,任何人都可以帮我这个请 这是我的代码的图像
NSString *digitLabelText;
if([self digit] == 0)
{
digitLabelText= [NSString stringWithFormat:@"%ld", (long)[self digit]];
}
else
{
if([self placeValue] == ONE || [self placeValue] == TEN ||
[self placeValue] == ONE_HUNDRED || [self placeValue] == ONE_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld", (long)[self digit]];
}
else if([self placeValue] == TEN_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld,000",(long)[self digit]/ONE_THOUSAND];
}
else if([self placeValue] == HUNDRED_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld,000", (long)[self digit]/ONE_THOUSAND];
}
else if([self placeValue] == ONE_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == TEN_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == HUNDRED_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == ONE_BILLION)
{
//issue come from this in iphone 4s ,5 digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];
}
else if([self placeValue] == TEN_BILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];///ONE_BILLION];
}
else if([self placeValue] == HUNDRED_BILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];///ONE_BILLION];
}
else if([self placeValue] == ONE_TRILLION)
{
digitLabelText= [NSString stringWithFormat:@"%lld tril", (long)[self digit]/ONE_TRILLION];///ONE_TRILLION];
}
}
digitLabel.text = digitLabelText;