I have a UITextField
which shows UIPickerView
. To disable the edit menu, I subclassed UITextField
and assigned it in the storyboard. But now the textfield is not changing the value according to change in locale. It always shows the value in English even if I switch to Arabic.
class PickerTextField: UITextField {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func caretRect(for position: UITextPosition) -> CGRect {
return CGRect.zero
}
func selectionRects(for range: UITextRange) -> [Any] {
return []
}
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
UIMenuController.shared.isMenuVisible = false
self.resignFirstResponder()
return false
}
}