[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 108/204: inputAccessory 'return'
From: |
gnunet |
Subject: |
[taler-taler-ios] 108/204: inputAccessory 'return' |
Date: |
Thu, 05 Dec 2024 23:51:16 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit d81aa50d4ec0f944c977512c2e50b56df10e19ab
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Nov 8 14:09:36 2024 +0100
inputAccessory 'return'
---
TalerWallet1/Views/HelperViews/CurrencyField.swift | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/CurrencyField.swift
b/TalerWallet1/Views/HelperViews/CurrencyField.swift
index 8507515..04de5bd 100644
--- a/TalerWallet1/Views/HelperViews/CurrencyField.swift
+++ b/TalerWallet1/Views/HelperViews/CurrencyField.swift
@@ -110,7 +110,7 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable {
textField.becomeFirstResponder()
}
- @MainActor public func resignFirstResponder() -> Void {
+ @MainActor public func resignFirstResponder() {
textField.resignFirstResponder()
Self.endEditing()
}
@@ -123,6 +123,27 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable
{
textField.selectedTextRange = textField.textRange(from: endPosition,
to: endPosition)
}
+ func toolBar() -> UIToolbar {
+ let image = UIImage(systemName: "return")
+ let button = UIBarButtonItem(image: image, style: .done, target:
textField,
+ action:
#selector(UITextField.resignFirstResponder))
+ let flexSpace = UIBarButtonItem(barButtonSystemItem:
UIBarButtonItem.SystemItem.flexibleSpace,
+ target: self, action: nil)
+ let toolBar: UIToolbar = UIToolbar()
+ toolBar.items = [flexSpace, button]
+
+ // Unable to simultaneously satisfy constraints
+ // Will attempt to recover by breaking constraint
+ // <NSLayoutConstraint: UIImageView: .centerY == _UIModernBarButton:
.centerY (active)>
+
+ // this all doesn't help
+// toolBar.frame.size.height = 100
+// toolBar.autoresizingMask = .flexibleWidth
+// toolBar.translatesAutoresizingMaskIntoConstraints = false
+ toolBar.sizeToFit()
+ return toolBar
+ }
+
func makeUIView(context: Context) -> NoCaretTextField {
textField.setContentCompressionResistancePriority(.defaultLow, for:
.horizontal)
@@ -130,7 +151,7 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable {
textField.delegate = context.coordinator
// Set keyboard type
- textField.keyboardType = .asciiCapableNumberPad // numberPad
+ textField.keyboardType = .asciiCapableNumberPad // numberPad
decimalPad phonePad numbersAndPunctuation
// Make visual components invisible...
textField.tintColor = .clear
@@ -154,6 +175,9 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable {
for: .editingChanged
)
+ // Add a toolbar with a done button above the keyboard
+ textField.inputAccessoryView = toolBar()
+
// Set initial textfield text
context.coordinator.updateText(amount, textField: textField)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 113/204: PendingOperations (unused), (continued)
- [taler-taler-ios] 113/204: PendingOperations (unused), gnunet, 2024/12/05
- [taler-taler-ios] 114/204: Pay, gnunet, 2024/12/05
- [taler-taler-ios] 110/204: deposit, gnunet, 2024/12/05
- [taler-taler-ios] 122/204: Yellow for confirm, gnunet, 2024/12/05
- [taler-taler-ios] 119/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 120/204: Withdraw, gnunet, 2024/12/05
- [taler-taler-ios] 116/204: Settings, gnunet, 2024/12/05
- [taler-taler-ios] 112/204: P2P, gnunet, 2024/12/05
- [taler-taler-ios] 121/204: TransactionById, gnunet, 2024/12/05
- [taler-taler-ios] 123/204: fake currency, gnunet, 2024/12/05
- [taler-taler-ios] 108/204: inputAccessory 'return',
gnunet <=
- [taler-taler-ios] 124/204: move DB to AppSupport, gnunet, 2024/12/05
- [taler-taler-ios] 111/204: exchange, gnunet, 2024/12/05
- [taler-taler-ios] 118/204: demoHints, gnunet, 2024/12/05
- [taler-taler-ios] 126/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 128/204: less logging, gnunet, 2024/12/05
- [taler-taler-ios] 129/204: currencyInfo, gnunet, 2024/12/05
- [taler-taler-ios] 131/204: wire fee, gnunet, 2024/12/05
- [taler-taler-ios] 115/204: Refund, gnunet, 2024/12/05
- [taler-taler-ios] 125/204: Button visible, gnunet, 2024/12/05
- [taler-taler-ios] 127/204: Remove "Amount too small", gnunet, 2024/12/05