0
Stock *stockObject;
stockObject = [[Stock alloc]initWithIssuingCompany:addCompany stockName:@"one" stockPrice:[NSNumber numberWithFloat:150.3]];
[availableStocks addObject:stockObject];
float myfloat = [s.stockPrice floatValue];
NSLog(@「singleton @%f」,myfloat);NSnumber in to NSstring
試試這個代碼,但它會暗戀:
float myfloat = [s.stockPrice floatValue];
沒有錯誤。
有人能幫助我嗎?
s.stockPrice從哪裏來?應該是stockObject.stockPrice?另外,你可能想要清理你的代碼格式。 – 2013-03-26 20:01:30