Posts

Post not yet marked as solved
5 Replies
1.8k Views
I have an UIButton and a UITextField. When I press the button, the text field is made the first responder.Here is the action for button press:@objc func btnAction(_ sender: Any?) { print("changeCount before pressing btn: \(UIPasteboard.general.changeCount)") txtField.becomeFirstResponder() DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2) { print("changeCount after showing kbd: \(UIPasteboard.general.changeCount)") }}When I press the button, the keyboard is shown and the changeCount of the general pasteboard is incremented by 2 even if I dont add anything to pasteboard!? Here's the output:...changeCount before pressing btn: 45changeCount after showing kbd: 47...On iOS 11, 12, it works as expected, the changedCount is not modified.Further on, I subclassed the UITextField like this:class CustomTextField: UITextField { override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { print("canPerformAction: \(action)") let a = super.canPerformAction(action, withSender: sender) print("changeCount after canPerformAction: \(UIPasteboard.general.changeCount)") return a }}The output is now:...changeCount before pressing btn: 45canPerformAction: paste:changeCount after canPerformAction: 46changeCount after showing kbd: 47...On iOS 11, 12, 'canPerformAction' is not called at all:...changeCount before pressing btn: 3003changeCount after showing kbd: 3003...It this a bug on iOS13 or am I doing something wrong?
Posted Last updated
.