link icon now scales in size with the text.
This commit is contained in:
parent
ce681db033
commit
8bf4befd02
@ -342,14 +342,11 @@ public typealias ActionBlock = () -> Void
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Appends an external link imcage to the end of the attributed string.
|
||||
|
||||
- Attention: This method expects text to be set first. Otherwise, it will do nothing.
|
||||
- Parameters:
|
||||
- magnitude: Applied to Width and Height of image for congruency.
|
||||
*/
|
||||
public func addExternalLinkIcon(magnitude: Int = 12) {
|
||||
|
||||
///Appends an external link image to the end of the attributed string.
|
||||
public func addExternalLinkIcon() {
|
||||
|
||||
let size = round(font.pointSize * 0.8)
|
||||
|
||||
guard let attributedText = self.attributedText else { return }
|
||||
|
||||
@ -357,7 +354,7 @@ public typealias ActionBlock = () -> Void
|
||||
|
||||
let imageAttachment = NSTextAttachment()
|
||||
imageAttachment.image = MVMCoreUIUtility.imageNamed("externalLink")
|
||||
imageAttachment.bounds = CGRect(x: 0, y: 0, width: magnitude, height: magnitude)
|
||||
imageAttachment.bounds = CGRect(x: 0, y: 0, width: size, height: size)
|
||||
|
||||
fullString.append(NSAttributedString(string: " "))
|
||||
fullString.append(NSAttributedString(attachment: imageAttachment))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user