Added exportIcon images. Added convenience function which adds the new images to attributed string.
This commit is contained in:
parent
cd577288c3
commit
8813646852
@ -340,6 +340,28 @@ public typealias ActionBlock = () -> Void
|
||||
standardFontSize = 0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
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) {
|
||||
|
||||
guard let attributedText = self.attributedText else { return }
|
||||
|
||||
let fullString = NSMutableAttributedString(attributedString: attributedText)
|
||||
|
||||
let imageAttachment = NSTextAttachment()
|
||||
imageAttachment.image = MVMCoreUIUtility.imageNamed("externalLink")
|
||||
imageAttachment.bounds = CGRect(x: 0, y: 0, width: magnitude, height: magnitude)
|
||||
|
||||
fullString.append(NSAttributedString(string: " "))
|
||||
fullString.append(NSAttributedString(attachment: imageAttachment))
|
||||
self.attributedText = fullString
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Atomization
|
||||
|
||||
6
MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json
Normal file
6
MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
23
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json
vendored
Normal file
23
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "exportBlack.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "exportBlack@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "exportBlack@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack.png
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 345 B |
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@2x.png
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 589 B |
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@3x.png
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 869 B |
Loading…
Reference in New Issue
Block a user