0

我正在研究天气应用程序。我将注释放在地图上,注释标注显示温度。但是,一旦温度超过三位数,它就会显示三个点而不是值。我如何格式化该值以显示三位数字。有什么建议么?

int value=[att integerValue];

它是:

annotation.title=[NSString stringWithFormat:@"Ozone Level:%@",value];

它是:

   annotation.title=[NSString stringWithFormat:@"Ozone Level: %@ ",value];
4

2 回答 2

1

整数不是指针,您正在尝试使用对象说明符 ( %@) 而不是整数说明符:

尝试

NSInteger value = [att integerValue];
annotation.title=[NSString stringWithFormat:@"Ozone Level: %d ", value];
于 2012-11-04T05:23:05.460 回答
-1

这三个点几乎肯定是操作系统告诉您标签不够大,无法显示完整数字。给标签更多的空间。

于 2012-11-04T04:27:04.080 回答