We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 表现 iOS 17,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)且没有文字时,光标与占位图重叠
如何重现
预期的表现 正常情况下,光标不与占位图重叠
原因 QMUITextView.placeholderLabel布局时会考虑kSystemTextViewFixTextInsets,当系统的textView.textContainerInset为 UIEdgeInsetsZero时,文字与边缘的间距为{0, 5, 0, 5},这个间距不能写死,系统是根据textView.textContainer.lineFragmentPadding的值来的,默认为5.0,如下图所示
kSystemTextViewFixTextInsets
{0, 5, 0, 5}
textView.textContainer.lineFragmentPadding
5.0
iOS 17及以上,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)时,也就是为负数时,文字和光标与边缘的间距还是lineFragmentPadding,系统不会考虑textContainerInset为负数的情况,所以就出现了上述的情况 iOS 17以下,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)时,系统会考虑到负数的情况,所以之前的版本就没问题。
lineFragmentPadding
解决方案 QMUITextView.allInsets使用self.textContainer.lineFragmentPadding,去掉kSystemTextViewFixTextInsets,iOS 17及以上判断textContainerInset为负数的情况,全版本适用。
self.textContainer.lineFragmentPadding
其他信息
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug 表现
iOS 17,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)且没有文字时,光标与占位图重叠
如何重现
预期的表现
正常情况下,光标不与占位图重叠
原因
QMUITextView.placeholderLabel布局时会考虑
kSystemTextViewFixTextInsets
,当系统的textView.textContainerInset为 UIEdgeInsetsZero时,文字与边缘的间距为{0, 5, 0, 5}
,这个间距不能写死,系统是根据textView.textContainer.lineFragmentPadding
的值来的,默认为5.0
,如下图所示iOS 17及以上,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)时,也就是为负数时,文字和光标与边缘的间距还是
lineFragmentPadding
,系统不会考虑textContainerInset为负数的情况,所以就出现了上述的情况iOS 17以下,当textContainerInset为UIEdgeInsetsMake(0, -5, 0, -5)时,系统会考虑到负数的情况,所以之前的版本就没问题。
解决方案
QMUITextView.allInsets使用
self.textContainer.lineFragmentPadding
,去掉kSystemTextViewFixTextInsets
,iOS 17及以上判断textContainerInset为负数的情况,全版本适用。其他信息
The text was updated successfully, but these errors were encountered: