Skip to content

设置inputType为CRInputType_Normal输入英文有问题 #43

Description

@Azraeltulips

设置inputType为CRInputType_Normal输入英文字母,在输入到第二英文时,左上角会出现一个浅蓝色的view

Activity

  1. Azraeltulips commented on Dec 3, 2020

    @Azraeltulips
    Author

    `#pragma mark - CustomBox

    • (CRBoxInputView *)generateBoxInputView_customBox
      {
      CRBoxInputCellProperty *cellProperty = [CRBoxInputCellProperty new];
      cellProperty.cellBgColorNormal = color_FFECEC;
      cellProperty.cellBgColorSelected = [UIColor whiteColor];
      cellProperty.cellCursorColor = color_master;
      cellProperty.cellCursorWidth = 2;
      cellProperty.cellCursorHeight = YY_6(27);
      cellProperty.cornerRadius = 4;
      cellProperty.borderWidth = 0;
      cellProperty.cellFont = [UIFont boldSystemFontOfSize:24];
      cellProperty.cellTextColor = color_master;
      cellProperty.configCellShadowBlock = ^(CALayer * _Nonnull layer) {
      layer.shadowColor = [color_master colorWithAlphaComponent:0.2].CGColor;
      layer.shadowOpacity = 1;
      layer.shadowOffset = CGSizeMake(0, 2);
      layer.shadowRadius = 4;
      };

      CRBoxInputView *_boxInputView = [[CRBoxInputView alloc] initWithCodeLength:4];
      _boxInputView.mainCollectionView.contentInset = UIEdgeInsetsMake(0, 10, 0, 10);
      _boxInputView.boxFlowLayout.itemSize = CGSizeMake(XX_6(52), XX_6(52));
      _boxInputView.customCellProperty = cellProperty;
      _boxInputView.keyBoardType = UIKeyboardTypeDefault;
      _boxInputView.inputType = CRInputType_Normal;

      [_boxInputView loadAndPrepareViewWithBeginEdit:YES];

      return _boxInputView;
      }`
      这个是我在demo里面修改了键盘类型和输入类型,也会出现同样的问题,输入h比较容易复现

  2. CoderGFWu commented on Dec 25, 2020

    @CoderGFWu

    我也碰到了, 兄弟, 有解决吗

  3. Azraeltulips commented on Dec 30, 2020

    @Azraeltulips
    Author

    我也碰到了, 兄弟, 有解决吗

    textField有个自动联想的属性autocorrectionType设置为no。然后要过滤一下中文,因为iPhone有一个自带的快捷文本,英文键盘输入msd,会有一个马上到的弹窗。
    `// MARK: ===============检查文字是否是中文===============
    private func checkStringIsChinese(_ string: String) -> Bool {
    for character in string {
    if character >= "\u{4E00}" && character <= "\u{9FA5}" {
    return true
    }
    }

        return false
    }`
    
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions