diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index d925ed0..92aae10 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -675,7 +675,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31; + CURRENT_PROJECT_VERSION = 32; DEVELOPMENT_TEAM = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VDSSample/Info.plist; @@ -707,7 +707,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31; + CURRENT_PROJECT_VERSION = 32; DEVELOPMENT_TEAM = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VDSSample/Info.plist; diff --git a/VDSSample/Classes/TextField.swift b/VDSSample/Classes/TextField.swift index ad68936..8612627 100644 --- a/VDSSample/Classes/TextField.swift +++ b/VDSSample/Classes/TextField.swift @@ -79,20 +79,25 @@ public class NumericField: TextField { public override func setup() { super.setup() - let keypadToolbar: UIToolbar = UIToolbar() + let keypadToolbar: UIToolbar = UIToolbar().with { $0.tintColor = .white; $0.backgroundColor = .white } // add a done button to the numberpad keypadToolbar.items=[ UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: self, action: nil), - UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.done, target: self, action: #selector(shouldResign)) + UIBarButtonItem(title: " - (minus sign)", style: .done, target: self, action: #selector(insertMinus)).with { $0.tintColor = .black}, + UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.done, target: self, action: #selector(shouldResign)).with { $0.tintColor = .black} ] keypadToolbar.sizeToFit() // add a toolbar with a done button above the number pad inputAccessoryView = keypadToolbar - keyboardType = .numberPad + keyboardType = .decimalPad } + @objc public func insertMinus() { + insertText("-") + } + public var number: NSNumber? { guard let text, let foundNumber = NumberFormatter().number(from: text) else { return nil } return foundNumber diff --git a/VDSSample/ViewControllers/LabelViewController.swift b/VDSSample/ViewControllers/LabelViewController.swift index 2bb4329..46b2c9e 100644 --- a/VDSSample/ViewControllers/LabelViewController.swift +++ b/VDSSample/ViewControllers/LabelViewController.swift @@ -30,6 +30,7 @@ class LabelViewController: BaseViewController