We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lineSpacing
class V3: UIViewController { let labelWithBonMot = UILabel() let label = UILabel() override func viewDidLoad() { super.viewDidLoad() labelWithBonMot.numberOfLines = 2 label.numberOfLines = 2 view.addSubview(labelWithBonMot) view.addSubview(label) labelWithBonMot.snp.makeConstraints { $0.top.equalToSuperview().offset(30) $0.left.right.equalToSuperview() } label.snp.makeConstraints { $0.left.right.equalToSuperview() $0.top.equalTo(labelWithBonMot.snp.bottom).offset(30) } /////////////////////////////////// let text = "聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖\n聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖聖" let contentStyle = StringStyle([.font(UIFont(name: "HiraginoSans-W3", size: 13)!), .tracking(.point(-0.3)), .lineSpacing(7), .lineBreakMode(.byTruncatingTail)]) labelWithBonMot.attributedText = text.styled(with: contentStyle) let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineBreakMode = .byTruncatingTail paragraphStyle.lineSpacing = 7 let attributes: [NSAttributedString.Key: Any] = [ .font: Fonts.HiraginoSans.w3.size(13), .kern: -0.3, .paragraphStyle: paragraphStyle ] label.attributedText = NSAttributedString(string: text, attributes: attributes) } }
Here is my code. It shows like this.
labelWithBonMot is not showing correct lineSpacing.
Here is a attributes what I've got in console
==== contentStyle.attributes ==== [__C.NSAttributedStringKey(_rawValue: NSParagraphStyle): Alignment 4, LineSpacing 7, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 4, Tabs ( 28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L, 252L, 280L, 308L, 336L ), DefaultTabInterval 0, Blocks ( ), Lists ( ), BaseWritingDirection -1, HyphenationFactor 0, TighteningForTruncation NO, HeaderLevel 0, __C.NSAttributedStringKey(_rawValue: BonMotTransformations): [[:]], __C.NSAttributedStringKey(_rawValue: NSKern): -0.3, __C.NSAttributedStringKey(_rawValue: NSFont): <UICTFont: 0x7fa752d0c2e0> font-family: "HiraginoSans-W3"; font-weight: normal; font-style: normal; font-size: 13.00pt] ==== native attributes ==== [__C.NSAttributedStringKey(_rawValue: NSFont): <UICTFont: 0x7fa752d0c2e0> font-family: "HiraginoSans-W3"; font-weight: normal; font-style: normal; font-size: 13.00pt, __C.NSAttributedStringKey(_rawValue: NSKern): -0.3, __C.NSAttributedStringKey(_rawValue: NSParagraphStyle): Alignment 4, LineSpacing 7, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 4, Tabs ( 28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L, 252L, 280L, 308L, 336L ), DefaultTabInterval 0, Blocks ( ), Lists ( ), BaseWritingDirection -1, HyphenationFactor 0, TighteningForTruncation NO, HeaderLevel 0]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here is my code.
It shows like this.
labelWithBonMot is not showing correct lineSpacing.
Here is a attributes what I've got in console
The text was updated successfully, but these errors were encountered: