UITextField, UITextInputAssistantItem hide and leak with iOS

I wanted to remove the UITextInputAssistantItem that we see when editing a text field. Why do we need to set the leading groupsBarButtonGroups and trailingBarButtonGroups to an empty array. But this leads to leaks and crashes of applications, where their widespread use is UITextField.

How to hide the shortcut bar in iOS9

 self.textfield.inputAssistantItem.leadingBarButtonGroups=@ []; self.textfield.inputAssistantItem.trailingBarButtonGroups=@ []; 

In my current viewController there are only two text fields and in the viewdidLoad the above code is all. But, I don’t know why this leads to leaks, its a headache for me when the interface has many text fields.

enter image description here

From the above image, we see that leaks are generated when editing text field creatures.

If I set it to nil, instead of an empty array, I still get leaks.

+5
source share

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


All Articles