UITextField Memory leakage on iOS 11, uitextfieldios
MLeaksFinder is used for project optimization and performance check. When the memory leakage of interface elements is checked, memory leakage occurs when you exit the logon interface. The print log is as follows:
In case that UITextField shocould not be dealloced, override-willDealloc in UITextField by returning NO. View-ViewController stack: (DLTLoginViewController, UIView, UIScrollView, UIView, UITextField)
The above MLeaksFinder log shows that UITextField is not released. The next step is to analyze the problem as follows:
Considering the strong reference problem, the UITextField attribute is defined as a weak reference, and the problem persists. The password box is blocked and the problem does not exist. However, the problem is that the password box is different from the user box in the secureTextEntry attribute. It is assumed that this attribute references the secureTextEntry setting in the comment Password box, no problem found
Solution
Custom Controls are not feasible in the delegate event of UITextField, processing secureTextEntry
-(BOOL) textFieldShouldBeginEditing :( UITextField *) textField {if (textField = self. passField) {textField. secureTextEntry = YES;} else {textField. secureTextEntry = NO;} return YES ;}