2011-07-11 6 views
0

に二重の値に問題は私が私ならば、私はその後、IOS:文字列

NSString *cost = [NSString stringWithFormat: @"%.2f", [[appDelegate.extra objectAtIndex:0]objectAtIndex:1]]; 

[label1 setText:[[appDelegate.extra objectAtIndex:0]objectAtIndex:0]]; 
[label2 setText:cost]; 

を行った後、私は配列

double myDouble = [textField2.text doubleValue]; 
NSArray *temp = [[NSArray alloc]initWithObjects: textField1.text, [NSNumber numberWithDouble:myDouble], nil]; 
[appDelegate.extra addObject:temp]; 

の配列にdouble値を挿入し、このコード

を持っていますtextField2に "1"を書きます。label2に "0.00"があります。なぜですか?

答えて

0

試してみてください。

NSString *cost = [NSString stringWithFormat: @"%.2f", [[appDelegate.extra objectAtIndex:0]objectAtIndex:1] floatValue]; 
関連する問題