updated makeAttributedString to use min lineHeight as well as read a var to help determine if this is really needed or not
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
b9082ac1d2
commit
d00b1d0a0e
@ -1163,7 +1163,7 @@
|
|||||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 31;
|
CURRENT_PROJECT_VERSION = 32;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
@ -1200,7 +1200,7 @@
|
|||||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 31;
|
CURRENT_PROJECT_VERSION = 32;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
|||||||
@ -19,8 +19,13 @@ extension NSAttributedString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension NSMutableAttributedString {
|
extension NSMutableAttributedString {
|
||||||
|
|
||||||
|
public static var useMinimumLineHeight: Bool = true
|
||||||
public static func mutableText(for text: String, textStyle: TextStyle, useScaledFont: Bool = true, textColor: UIColor, alignment: NSTextAlignment = .left, lineBreakMode: NSLineBreakMode) -> NSMutableAttributedString {
|
public static func mutableText(for text: String, textStyle: TextStyle, useScaledFont: Bool = true, textColor: UIColor, alignment: NSTextAlignment = .left, lineBreakMode: NSLineBreakMode) -> NSMutableAttributedString {
|
||||||
|
|
||||||
|
//var for if you can scale or not
|
||||||
|
let scaledMode = useScaledFont && TextStyle.canScaleFonts
|
||||||
|
|
||||||
//create the paragraph for specific properties
|
//create the paragraph for specific properties
|
||||||
let paragraph = NSMutableParagraphStyle()
|
let paragraph = NSMutableParagraphStyle()
|
||||||
paragraph.alignment = alignment
|
paragraph.alignment = alignment
|
||||||
@ -29,13 +34,16 @@ extension NSMutableAttributedString {
|
|||||||
var defaultFont = textStyle.font
|
var defaultFont = textStyle.font
|
||||||
var lineHeight = textStyle.lineHeight
|
var lineHeight = textStyle.lineHeight
|
||||||
|
|
||||||
if useScaledFont {
|
if scaledMode {
|
||||||
lineHeight = textStyle.scaledLineHeight
|
lineHeight = textStyle.scaledLineHeight
|
||||||
defaultFont = defaultFont.scaledFont
|
defaultFont = defaultFont.scaledFont
|
||||||
}
|
}
|
||||||
|
|
||||||
//set lineHeight
|
//set lineHeight
|
||||||
if textStyle.lineHeight > 0.0 {
|
if textStyle.lineHeight > 0.0 {
|
||||||
|
if useMinimumLineHeight {
|
||||||
|
paragraph.minimumLineHeight = lineHeight
|
||||||
|
}
|
||||||
paragraph.maximumLineHeight = lineHeight
|
paragraph.maximumLineHeight = lineHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,20 @@
|
|||||||
|
1.0.32
|
||||||
|
=======
|
||||||
|
- Fixed bug dealing with Scaled
|
||||||
|
- Added ability to use minimumLineheight in Paragraph for AttributedString creation
|
||||||
|
|
||||||
1.0.31
|
1.0.31
|
||||||
=======
|
=======
|
||||||
- Upated Label to allow Scaled Fonts
|
- updated version only
|
||||||
|
|
||||||
|
1.0.30
|
||||||
|
=======
|
||||||
|
- Updated Label to allow Scaled Fonts
|
||||||
- Refactored Code TextStyle
|
- Refactored Code TextStyle
|
||||||
|
|
||||||
1.0.29
|
1.0.29
|
||||||
=======
|
=======
|
||||||
- Upated TextStyle and Label for dealing with Top/Bottom insets
|
- Updated TextStyle and Label for dealing with Top/Bottom insets
|
||||||
- Refactored Code for Checkbox/RadioButton/Toggle
|
- Refactored Code for Checkbox/RadioButton/Toggle
|
||||||
|
|
||||||
1.0.28
|
1.0.28
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user