Assign Yourself UITextFieldDelegate works in iOS 8 not in iOS 7

In the past, I have subclassed UITableView and UICollectonView many times in which I assigned myself to the delegate and data source, and it worked fine.

Today I tried to subclass UITextField , and in this I assign myself to its delegate as

 self.delegate = self 

where the delegate inherits from UITextFiled . In the above case, it hangs the application forever in iOS 7, but works for iOS 8. Another amazing thing: when I try to enter text into it from the hardware keyboard, then it works fine, but it can be hung when entering characters from the on-screen keyboard.

What could be causing this, can someone help me understand?

+5
source share
1 answer

I had a similar problem and understood this. The simulator will no longer raise the keyboard. If there is an accessible and detectable hardware keyboard (for example, on a MacBook), the simulator will look for the input from it, and the simulated iPhone keyboard will not rise. This creates a problem with the delegate. All you have to do is in the menu "Equipment for the simulator" in the "Keyboard" section, deselect "Connect hardware keyboard". Hope this helps.

0
source

Source: https://habr.com/ru/post/1204973/


All Articles