Ad

Our DNA is written in Swift
Jump

Radar: UITextField’s implementation of UITextInput protocol

For the ProductLayer SDK I have built a text field that keeps track of the last used input language. When implementing this I noticed that several of the methods that UITextField claims to be implementing are not being called. Apparently this is a new bug in iOS 8.

Filed as rdar://19263531 and on Open Radar.

Summary

UITextField’s header states that it is implementing the UITextInput protocol. However this is only partially true.

Our tests show that -deleteBackward and -replaceRange:withText: are not called on subclasses of UITextField. Only -insertText from UIKeyInput is being called.

This is an inconsistency that confuses developers requiring subclassing of UITextField.

Steps to Reproduce

  • Subclass UITextField
  • override -deleteBackward
  • set a breakpoint there
  • use this subclass in an app

Expected Results

  • When the user hits the backspace key the -deleteBackward method should be called.
  • When the user inserts or replaces ranges of text, the -replaceRange:withText: method should be called

Actual Results

  • -deleteBackward is not called
  • -replaceRange:withText is not called

Categories: Bug Reports

Leave a Comment

%d bloggers like this: