保存NSDecimalNumber
时EditViewController
,出现 inDisplayTableViewController
值NaN
请需要建议来解决此问题。谢谢
我的代码:
- (IBAction)saveChanges:(id)sender {
editGift.nameOfGift = nameTextField.text;
editGift.priceOfGift = [NSDecimalNumber decimalNumberWithString:priceTextField.text];
AppDelegate *myApp = (AppDelegate *) [[UIApplication sharedApplication]delegate];
[myApp saveContext];
[self.delegate editGiftViewControllerDidSave:self];
}
输入值:
currencyFormatter = [[NSNumberFormatter alloc]init];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
personGift.priceOfGift = [NSDecimalNumber decimalNumberWithString:priceTextField.text];