Skip to content

Commit 98fc0b6

Browse files
committed
1.5.2 修复使用非系统字体导致的Label点击无效的问题.
1 parent 7d1b4cd commit 98fc0b6

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

AttributedString.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

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

77
s.homepage = "https://github.com/lixiang1994/AttributedString"

AttributedString.xcodeproj/project.pbxproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@
824824
"@executable_path/Frameworks",
825825
"@loader_path/Frameworks",
826826
);
827-
MARKETING_VERSION = 1.5.1;
827+
MARKETING_VERSION = 1.5.2;
828828
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
829829
PRODUCT_NAME = AttributedString;
830830
SDKROOT = watchos;
@@ -852,7 +852,7 @@
852852
"@executable_path/Frameworks",
853853
"@loader_path/Frameworks",
854854
);
855-
MARKETING_VERSION = 1.5.1;
855+
MARKETING_VERSION = 1.5.2;
856856
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.watchos;
857857
PRODUCT_NAME = AttributedString;
858858
SDKROOT = watchos;
@@ -879,7 +879,7 @@
879879
"@executable_path/Frameworks",
880880
"@loader_path/Frameworks",
881881
);
882-
MARKETING_VERSION = 1.5.1;
882+
MARKETING_VERSION = 1.5.2;
883883
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
884884
PRODUCT_NAME = AttributedString;
885885
SDKROOT = appletvos;
@@ -906,7 +906,7 @@
906906
"@executable_path/Frameworks",
907907
"@loader_path/Frameworks",
908908
);
909-
MARKETING_VERSION = 1.5.1;
909+
MARKETING_VERSION = 1.5.2;
910910
PRODUCT_BUNDLE_IDENTIFIER = com.attributedstring.tvos;
911911
PRODUCT_NAME = AttributedString;
912912
SDKROOT = appletvos;
@@ -982,7 +982,7 @@
982982
"@loader_path/Frameworks",
983983
);
984984
MACOSX_DEPLOYMENT_TARGET = 10.13;
985-
MARKETING_VERSION = 1.5.1;
985+
MARKETING_VERSION = 1.5.2;
986986
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
987987
PRODUCT_NAME = AttributedString;
988988
SDKROOT = macosx;
@@ -1009,7 +1009,7 @@
10091009
"@loader_path/Frameworks",
10101010
);
10111011
MACOSX_DEPLOYMENT_TARGET = 10.13;
1012-
MARKETING_VERSION = 1.5.1;
1012+
MARKETING_VERSION = 1.5.2;
10131013
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.macos;
10141014
PRODUCT_NAME = AttributedString;
10151015
SDKROOT = macosx;
@@ -1156,7 +1156,7 @@
11561156
"@executable_path/Frameworks",
11571157
"@loader_path/Frameworks",
11581158
);
1159-
MARKETING_VERSION = 1.5.1;
1159+
MARKETING_VERSION = 1.5.2;
11601160
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
11611161
PRODUCT_NAME = AttributedString;
11621162
SKIP_INSTALL = YES;
@@ -1184,7 +1184,7 @@
11841184
"@executable_path/Frameworks",
11851185
"@loader_path/Frameworks",
11861186
);
1187-
MARKETING_VERSION = 1.5.1;
1187+
MARKETING_VERSION = 1.5.2;
11881188
PRODUCT_BUNDLE_IDENTIFIER = com.lee.attributedstring.ios;
11891189
PRODUCT_NAME = AttributedString;
11901190
SKIP_INSTALL = YES;

Sources/Extension/AppKit/NSTextFieldExtension.swift

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ fileprivate extension NSTextField {
244244
let textStorage = NSTextStorage(attributedString: attributedString.value)
245245
let textContainer = NSTextContainer(size: bounds.size)
246246
let layoutManager = NSLayoutManager()
247+
layoutManager.usesFontLeading = false // 不使用字体的头 因为非系统字体会出现问题
247248
layoutManager.addTextContainer(textContainer)
248249
textStorage.addLayoutManager(layoutManager)
249250
textContainer.lineBreakMode = lineBreakMode

Sources/Extension/UIKit/UILabelExtension.swift

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ fileprivate extension UILabel {
274274
let textStorage = NSTextStorage(attributedString: attributedString.value)
275275
let textContainer = NSTextContainer(size: bounds.size)
276276
let layoutManager = NSLayoutManager()
277+
layoutManager.usesFontLeading = false // 不使用字体的头 因为非系统字体会出现问题
277278
layoutManager.addTextContainer(textContainer)
278279
textStorage.addLayoutManager(layoutManager)
279280
textContainer.lineBreakMode = lineBreakMode

0 commit comments

Comments
 (0)