Skip to content

Commit

Permalink
1.5.2 修复使用非系统字体导致的Label点击无效的问题.
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiang1994 committed Jul 9, 2020
1 parent 7d1b4cd commit 98fc0b6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AttributedString.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "AttributedString"
s.version = "1.5.1"
s.version = "1.5.2"
s.summary = "基于Swift字符串插值快速构建你想要的富文本, 支持点击按住等事件获取, 支持多种类型过滤"

s.homepage = "https://github.com/lixiang1994/AttributedString"
Expand Down
16 changes: 8 additions & 8 deletions AttributedString.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
PRODUCT_NAME = AttributedString;
SDKROOT = watchos;
Expand Down Expand Up @@ -852,7 +852,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
PRODUCT_NAME = AttributedString;
SDKROOT = watchos;
Expand All @@ -879,7 +879,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
PRODUCT_NAME = AttributedString;
SDKROOT = appletvos;
Expand All @@ -906,7 +906,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
PRODUCT_NAME = AttributedString;
SDKROOT = appletvos;
Expand Down Expand Up @@ -982,7 +982,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
PRODUCT_NAME = AttributedString;
SDKROOT = macosx;
Expand All @@ -1009,7 +1009,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
PRODUCT_NAME = AttributedString;
SDKROOT = macosx;
Expand Down Expand Up @@ -1156,7 +1156,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
PRODUCT_NAME = AttributedString;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1184,7 +1184,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.2;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
PRODUCT_NAME = AttributedString;
SKIP_INSTALL = YES;
Expand Down
1 change: 1 addition & 0 deletions Sources/Extension/AppKit/NSTextFieldExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ fileprivate extension NSTextField {
let textStorage = NSTextStorage(attributedString: attributedString.value)
let textContainer = NSTextContainer(size: bounds.size)
let layoutManager = NSLayoutManager()
layoutManager.usesFontLeading = false // 不使用字体的头 因为非系统字体会出现问题
layoutManager.addTextContainer(textContainer)
textStorage.addLayoutManager(layoutManager)
textContainer.lineBreakMode = lineBreakMode
Expand Down
1 change: 1 addition & 0 deletions Sources/Extension/UIKit/UILabelExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ fileprivate extension UILabel {
let textStorage = NSTextStorage(attributedString: attributedString.value)
let textContainer = NSTextContainer(size: bounds.size)
let layoutManager = NSLayoutManager()
layoutManager.usesFontLeading = false // 不使用字体的头 因为非系统字体会出现问题
layoutManager.addTextContainer(textContainer)
textStorage.addLayoutManager(layoutManager)
textContainer.lineBreakMode = lineBreakMode
Expand Down

0 comments on commit 98fc0b6

Please sign in to comment.