UITextField Memory leakage on iOS 11, uitextfieldios

Source: Internet
Author: User

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 ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.