fix
杨锴
2024-08-23 adc2db9bb29e7f316c46b6de679db1522ffc9cc8
Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQTextView/IQTextView.swift
@@ -165,7 +165,7 @@
        }
    }
    @objc override weak open var delegate: UITextViewDelegate? {
    @objc override weak open var delegate: (any UITextViewDelegate)? {
        get {
            refreshPlaceholder()
@@ -188,14 +188,15 @@
        return newSize
    }
    @objc override open func caretRect(for position: UITextPosition) -> CGRect {
        var originalRect = super.caretRect(for: position)
        // When placeholder is visible and text alignment is centered
        if placeholderLabel.alpha == 1 && self.textAlignment == .center {
            // Calculate the width of the placeholder text
            let textSize = placeholderLabel.text?.size(withAttributes: [.font: placeholderLabel.font ?? UIFont.systemFont(ofSize: UIFont.systemFontSize)]) ?? .zero
            let font = placeholderLabel.font ?? UIFont.systemFont(ofSize: UIFont.systemFontSize)
            let textSize = placeholderLabel.text?.size(withAttributes: [.font: font]) ?? .zero
            // Calculate the starting x position of the centered placeholder text
            let centeredTextX = (self.bounds.size.width - textSize.width) / 2
            // Update the caret position to match the starting x position of the centered text
@@ -203,6 +204,5 @@
        }
        return originalRect
    }
    }
}