From 420a8747113aafc419ffcd7445e549d1e9684fc5 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 5 Dec 2019 14:07:53 -0500 Subject: [PATCH] Making container tappabble to increase actionable surface area. --- MVMCoreUI/Atoms/TextFields/DigitBox.swift | 63 ++++++++++--------- .../Atoms/TextFields/TextEntryField.swift | 3 + .../views/EntryFieldContainer.swift | 2 - 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/MVMCoreUI/Atoms/TextFields/DigitBox.swift b/MVMCoreUI/Atoms/TextFields/DigitBox.swift index 8cdbcd4f..dc2ad1c4 100644 --- a/MVMCoreUI/Atoms/TextFields/DigitBox.swift +++ b/MVMCoreUI/Atoms/TextFields/DigitBox.swift @@ -120,6 +120,10 @@ import UIKit if let bottomBar = bottomBar { layer.addSublayer(bottomBar) } + + let tap = UITapGestureRecognizer(target: self, action: #selector(callTextField)) + addGestureRecognizer(tap) + updateView(MVMCoreUISplitViewController.getDetailViewWidth()) } @@ -144,40 +148,41 @@ import UIKit //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- - + + @objc public func callTextField() { + + digitField.becomeFirstResponder() + } + @objc public override func updateView(_ size: CGFloat) { super.updateView(size) - DispatchQueue.main.async { [weak self] in - guard let self = self else { return } + if !MVMCoreGetterUtility.fequal(a: Float(size), b: Float(previousSize)) { + MFStyler.styleTextField(digitField) + digitField.font = MFFonts.mfFont55Rg(28) - if !MVMCoreGetterUtility.fequal(a: Float(size), b: Float(self.previousSize)) { - MFStyler.styleTextField(self.digitField) - self.digitField.font = MFFonts.mfFont55Rg(28) - - var width: CGFloat = 0 - var height: CGFloat = 0 - - let sizeObject = MFSizeObject(standardBlock: { - width = 39 - height = 44 - - }, smalliPhone: { - width = 35 - height = 38 - - }, standardiPadPortraitBlock: { - width = 59 - height = 74 - }) - - sizeObject?.performBlockBase(onSize: size) - self.widthConstraint?.constant = width - self.heightConstraint?.constant = height - self.previousSize = size - } + var width: CGFloat = 0 + var height: CGFloat = 0 - self.setNeedsLayout() + let sizeObject = MFSizeObject(standardBlock: { + width = 39 + height = 44 + + }, smalliPhone: { + width = 35 + height = 38 + + }, standardiPadPortraitBlock: { + width = 59 + height = 74 + }) + + sizeObject?.performBlockBase(onSize: size) + widthConstraint?.constant = width + heightConstraint?.constant = height + previousSize = size } + + setNeedsLayout() } } diff --git a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift index 5392c636..369cfae9 100644 --- a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift @@ -166,6 +166,9 @@ import UIKit textFieldTrailingConstraint = container.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 16) textFieldTrailingConstraint?.isActive = true + let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing)) + entryFieldContainer.addGestureRecognizer(tap) + accessibilityElements = [titleLabel, textField, feedbackLabel] } diff --git a/MVMCoreUI/Containers/views/EntryFieldContainer.swift b/MVMCoreUI/Containers/views/EntryFieldContainer.swift index 4300e37d..800f73af 100644 --- a/MVMCoreUI/Containers/views/EntryFieldContainer.swift +++ b/MVMCoreUI/Containers/views/EntryFieldContainer.swift @@ -271,7 +271,5 @@ import UIKit self.delegateObject = delegateObject guard let dictionary = json, !dictionary.isEmpty else { return } - - } }