Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

页面中添加textfield 或者textview 会导致控制器无法释放 #8

Closed
hongfenglt opened this issue Mar 14, 2018 · 2 comments
Closed

Comments

@hongfenglt
Copy link

hongfenglt commented Mar 14, 2018

页面中添加textfield 或者textview 会导致控制器无法释放,可以看键盘处理页面
目前发现注释父类中 field.delegate = self; 可以可以释放

@NJHu
Copy link
Owner

NJHu commented Mar 15, 2018

  • 首先非常感谢您提出问题和给出解决方案

  • 您给出的解决方案的确可行, 控制器会释放

  • 我的的测试步骤

    • 1, 检查代码, 有没有 block 造成的循环引用, 结果是: 没有
    • 2, 调试工具调试
      image

-结果: 是第三方 IQKeyboardReturnKeyHandler 这个类创建的对象存在的 bug,

@implementation IQKeyboardReturnKeyHandler
{
    NSMutableSet *textFieldInfoCache;
}

-(void)addTextFieldView:(UIView*)view
{
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
    
    dict[kIQTextField] = view;
    
    if ([view isKindOfClass:[UITextField class]] || [view isKindOfClass:[UITextView class]])
    {
        UITextField *textField = (UITextField*)view;
        dict[kIQTextFieldReturnKeyType] = @(textField.returnKeyType);
     // 怀疑是这里
        if (textField.delegate) dict[kIQTextFieldDelegate] = textField.delegate;
        [textField setDelegate:self];
    }

    [textFieldInfoCache addObject:dict];
}

@hongfenglt
Copy link
Author

感谢回复,确实是IQKeyboard的问题
hackiftekhar/IQKeyboardManager#1228

@NJHu NJHu closed this as completed Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants