Skip to content

SLEditTextView的两个bug #13

Description

@yaoyongmin
  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];
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions