How do I (if possible) programmatically change a UITextView's input type? For example, switching between the keyboard type 'URL' instead of 'Phone Pad'.
This is where you would change it regularly:
Thank you.
How do I (if possible) programmatically change a UITextView's input type? For example, switching between the keyboard type 'URL' instead of 'Phone Pad'.
This is where you would change it regularly:
Thank you.
Here is a solution from https://www.tutorialspoint.com/how-to-restrict-uitextfield-to-take-only-numbers-in-swift
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var tf: UITextField!
override func viewDidLoad() {
tf.delegate = self
super.viewDidLoad()
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let x = string.rangeOfCharacter(from: NSCharacterSet.decimalDigits) {
return true
} else {
return false
}
}
}