我想将值设置Key1
为10.00
本身而不是10
NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:
[NSDecimalNumber decimalNumberWithString:@"10.00"],
[NSDecimalNumber decimalNumberWithString:@"10.19"],nil]
forKeys:[NSArray arrayWithObjects:@"Key1",@"Key2",nil]];
NSLog(@"Value For Key1 NSDecimalNumber %@",[dict valueForKey:@"Key1"]);
NSLog(@"Value For Key1 float %f",[[dict valueForKey:@"Key1"] floatValue]);
NSLog(@"Value For Key2 NSDecimalNumber %@",[dict valueForKey:@"Key2"]);
NSLog(@"Value For Key2 float %f",[[dict valueForKey:@"Key2"] floatValue]);
这是我从控制台获得的日志
2013-05-16 12:43:23.316 SampleTest[6569:19d03] Value For Key1 NSDecimalNumber 10
2013-05-16 12:43:23.771 SampleTest[6569:19d03] Value For Key1 float 10.000000
2013-05-16 12:43:24.263 SampleTest[6569:19d03] Value For Key2 NSDecimalNumber 10.19
2013-05-16 12:43:25.195 SampleTest[6569:19d03] Value For Key2 float 10.190000
谁能帮我吗???
提前致谢..