Comments added. Further logic added for adding image attachments.
This commit is contained in:
parent
3a31441bc8
commit
6dd7cab8f4
@ -413,15 +413,18 @@ public typealias ActionBlock = () -> Void
|
|||||||
|
|
||||||
let mutableString = NSMutableAttributedString(attributedString: attributedText)
|
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(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
|
self.attributedText = mutableString
|
||||||
|
|
||||||
if index < attributedText.length {
|
// if index < attributedText.length {
|
||||||
hasAttachmentImageInsideText = true
|
// hasAttachmentImageInsideText = true
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getTextAttachmentImage(dimension: CGFloat) -> NSTextAttachment {
|
static func getTextAttachmentImage(dimension: CGFloat) -> NSTextAttachment {
|
||||||
@ -588,6 +591,7 @@ extension UITapGestureRecognizer {
|
|||||||
|
|
||||||
func didTapAttributedTextInLabel(_ label: Label, inRange targetRange: NSRange, offset: Int) -> Bool {
|
func didTapAttributedTextInLabel(_ label: Label, inRange targetRange: NSRange, offset: Int) -> Bool {
|
||||||
|
|
||||||
|
// There would only ever be one clause to act on.
|
||||||
if label.makeWholeViewClickable {
|
if label.makeWholeViewClickable {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user