iOS_Tips icon indicating copy to clipboard operation
iOS_Tips copied to clipboard

SLEditTextView的两个bug

Open yaoyongmin opened this issue 5 years ago • 1 comments

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

yaoyongmin avatar Apr 16 '20 01:04 yaoyongmin

@yaoyongmin 好的,感谢

wsl2ls avatar Apr 16 '20 05:04 wsl2ls