mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-18 19:56:27 +00:00
Fix emoji position on iOS 15
This commit is contained in:
parent
67cc55a08e
commit
3e93ced674
1 changed files with 16 additions and 10 deletions
|
@ -24,20 +24,26 @@ final class AnimatedAttachmentLabel: UILabel, EmojiInsertable {
|
||||||
.attachment,
|
.attachment,
|
||||||
in: NSRange(location: 0, length: attributedText.length),
|
in: NSRange(location: 0, length: attributedText.length),
|
||||||
options: .longestEffectiveRangeNotRequired) { attachment, _, _ in
|
options: .longestEffectiveRangeNotRequired) { attachment, _, _ in
|
||||||
guard let animatedAttachment = attachment as? AnimatedTextAttachment,
|
guard let animatedAttachment = attachment as? AnimatedTextAttachment,
|
||||||
let imageBounds = animatedAttachment.imageBounds
|
let imageBounds = animatedAttachment.imageBounds
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
animatedAttachment.imageView.frame = imageBounds
|
animatedAttachment.imageView.frame = imageBounds
|
||||||
animatedAttachment.imageView.contentMode = .scaleAspectFit
|
|
||||||
|
|
||||||
if animatedAttachment.imageView.superview != self {
|
// iOS 15 needs this for some inexplicable reason
|
||||||
addSubview(animatedAttachment.imageView)
|
if #available(iOS 15, *) {
|
||||||
|
animatedAttachment.imageView.frame.origin.y -= font.lineHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
animatedAttachment.imageView.contentMode = .scaleAspectFit
|
||||||
|
|
||||||
|
if animatedAttachment.imageView.superview != self {
|
||||||
|
addSubview(animatedAttachment.imageView)
|
||||||
|
}
|
||||||
|
|
||||||
|
attachmentImageViews.insert(animatedAttachment.imageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
attachmentImageViews.insert(animatedAttachment.imageView)
|
|
||||||
}
|
|
||||||
|
|
||||||
for subview in subviews {
|
for subview in subviews {
|
||||||
guard let attachmentImageView = subview as? SDAnimatedImageView else { continue }
|
guard let attachmentImageView = subview as? SDAnimatedImageView else { continue }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue