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

SLEditTextView的两个bug #13

Open
yaoyongmin opened this issue Apr 16, 2020 · 1 comment
Open

SLEditTextView的两个bug #13

yaoyongmin opened this issue Apr 16, 2020 · 1 comment

Comments

@yaoyongmin
Copy link

  1. 切换键盘样式,会自动多生成一个此视图

  2. 使用搜狗键盘自动缩回键盘时,此视图无法恢复到原状

修改代码:

  1. //颜色选择菜单视图
  • (void)colorSelectionView:(CGFloat)keyboardHeight {
    // for (UIView *subView in self.subviews) {
    // if (subView != self.doneEditBtn || subView != self.cancleEditBtn || subView != self.textView) {
    // continue;
    // }else {
    // [subView removeFromSuperview];
    // }
    // }

    for (UIView *view in self.subviews) {
    if ([view isEqual:self.cancleEditBtn] || [view isEqual:self.doneEditBtn] || [view isEqual:self.textView]) {
    continue;
    }
    [view removeFromSuperview];
    }

  1. 添加键盘消失监听事件

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

//键盘即将消失

  • (void)keyboardWillHide:(NSNotification *)notification{
    [self.textView resignFirstResponder];
    if (self.editTextCompleted) {
    self.editTextCompleted(nil);
    }
    [self removeFromSuperview];
    }
@wsl2ls
Copy link
Owner

wsl2ls commented Apr 16, 2020

@yaoyongmin 好的,感谢

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