diff --git a/CHANGELOG.md b/CHANGELOG.md index 09fa99b..3034fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 3.3 (2021-04-02) + +- Fixes tappability of regions relocated to a new line to avoid single-word last lines by UILabel. This requires compiling using Xcode 12, but works backwards-compatibly. +- Fixes accessibility elements sometimes exposing more than 1 element per tappable span. + # 3.2 (2020-04-17) - Fixes handling accessibility element activation that spans multiple lines. diff --git a/ZSWTappableLabel/ZSWTappableLabel.m b/ZSWTappableLabel/ZSWTappableLabel.m index c6f78d9..eb69a31 100644 --- a/ZSWTappableLabel/ZSWTappableLabel.m +++ b/ZSWTappableLabel/ZSWTappableLabel.m @@ -137,10 +137,18 @@ - (ZSWTappableLabelTouchHandling *)createTouchHandlingIfNeeded { range:range]; } }]; - + +#ifdef __IPHONE_14_0 + // lineBreakStrategy was exposed publicly in Xcode 12, but works backwords-compatibly + if (self.textAlignment != NSTextAlignmentLeft || self.lineBreakStrategy != NSLineBreakStrategyNone) { +#else if (self.textAlignment != NSTextAlignmentLeft) { +#endif NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; style.alignment = self.textAlignment; +#ifdef __IPHONE_14_0 + style.lineBreakStrategy = self.lineBreakStrategy; +#endif [attributedText enumerateAttribute:NSParagraphStyleAttributeName inRange:NSMakeRange(0, attributedText.length)