                     }
                     return true
                 }
-                
+
                 let valueIfTrue = textField.text?.substring(with: range).qmui_lengthWhenCountingNonASCIICharacterAsTwo ?? 0
                 let rangeLength = UInt(shouldCountingNonASCIICharacterAsTwo ? valueIfTrue : range.length)
-                
+
                 let textWillOutofMaximumTextLength = lengthWithString(textField.text ?? "") - rangeLength + lengthWithString(string) > textField.maximumTextLength
                 if textWillOutofMaximumTextLength {
                     // 将要插入的文字裁剪成这么长，就可以让它插入了

 *  4. 修复 iOS 10 之后 UITextField 输入中文超过文本框宽度后再删除，文字往下掉的 bug。
 */
class QMUITextField: UITextField, QMUITextFieldDelegate, UIScrollViewDelegate {
    
    private weak var originalDelegate: QMUITextFieldDelegate?
    
    override var delegate: UITextFieldDelegate? {
        didSet {
            originalDelegate = delegate as? QMUITextFieldDelegate
        }
    }
    
    /**
     *  修改 placeholder 的颜色，默认是 UIColorPlaceholder。
     */

     *  @param replacementString 要变化的文字，如果在 UIControlEventEditingChanged 里，这里永远传入 nil。
     */
    @objc optional func textField(_ textField: QMUITextField,
                                  didPreventTextChangeInRange range: NSRange,
                                  replacementString: String?) -> Void
}

/**
