From 49fb4415fc324cd118d772ba350e09795f55a342 Mon Sep 17 00:00:00 2001 From: Swen van Zanten Date: Wed, 9 Jan 2019 22:43:46 +0100 Subject: [PATCH] Currency input needed final format --- VergeiOS/Components/UI/Inputs/CurrencyInput.swift | 4 ++++ VergeiOS/Views/Receive/ReceiveViewController.swift | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/VergeiOS/Components/UI/Inputs/CurrencyInput.swift b/VergeiOS/Components/UI/Inputs/CurrencyInput.swift index 4c12c2a2..7018dacc 100644 --- a/VergeiOS/Components/UI/Inputs/CurrencyInput.swift +++ b/VergeiOS/Components/UI/Inputs/CurrencyInput.swift @@ -32,7 +32,11 @@ class CurrencyInput: UITextField { @objc public func editingDidEnd(_ textField: UITextField) { if getNumber().doubleValue == 0.0 { textField.text = "" + return } + + // Final Format. + setAmount(getNumber()) } public func getNumber() -> NSNumber { diff --git a/VergeiOS/Views/Receive/ReceiveViewController.swift b/VergeiOS/Views/Receive/ReceiveViewController.swift index 20640dae..a9bded51 100644 --- a/VergeiOS/Views/Receive/ReceiveViewController.swift +++ b/VergeiOS/Views/Receive/ReceiveViewController.swift @@ -53,7 +53,7 @@ class ReceiveViewController: UIViewController { addTapRecognizer(target: addressTextField, action: #selector(copyAddress(recognizer:))) addTapRecognizer(target: xvgCardImageView, action: #selector(copyAddress(recognizer:))) - amountTextField.addTarget(self, action: #selector(amountTextFieldDidChange), for: .editingChanged) + amountTextField.addTarget(self, action: #selector(amountTextFieldDidChange), for: .editingDidEnd) } override func viewWillAppear(_ animated: Bool) {