Comments added. Further logic added for adding image attachments.

This commit is contained in:
Kevin G Christiano 2019-07-26 14:46:29 -04:00
parent 3a31441bc8
commit 6dd7cab8f4

View File

@ -413,15 +413,18 @@ public typealias ActionBlock = () -> Void
let mutableString = NSMutableAttributedString(attributedString: attributedText)
if index != 0 {
if index == 0 {
mutableString.insert(NSAttributedString(attachment: Label.getTextAttachmentImage(dimension: font.pointSize)), at: index)
} else {
mutableString.insert(NSAttributedString(string: " "), at: index)
mutableString.insert(NSAttributedString(attachment: Label.getTextAttachmentImage(dimension: font.pointSize)), at: index + 1)
}
mutableString.insert(NSAttributedString(attachment: Label.getTextAttachmentImage(dimension: font.pointSize)), at: index + 1)
self.attributedText = mutableString
if index < attributedText.length {
hasAttachmentImageInsideText = true
}
// if index < attributedText.length {
// hasAttachmentImageInsideText = true
// }
}
static func getTextAttachmentImage(dimension: CGFloat) -> NSTextAttachment {
@ -588,6 +591,7 @@ extension UITapGestureRecognizer {
func didTapAttributedTextInLabel(_ label: Label, inRange targetRange: NSRange, offset: Int) -> Bool {
// There would only ever be one clause to act on.
if label.makeWholeViewClickable {
return true
}