0

Due to the iOS 16 will be using TextKit 2 as default, does anyone know if it is possible to set TextKit 1 as default in the UILabels in iOS 16?

We need to keep the same UI in iOS 16 and iOS 15 by contract (the app only supports iPhone 11 pro) and we have found a lot of UILabels that render its contents in a different way during our first test in iOS 16.

For instance, you can change this in a TextView under the text layout option (image attached), please see this for references: https://developer.apple.com/videos/play/wwdc2022/10090/ (minute 5:24)

enter image description here

That said, if Apple supports this, do they support changing this in an UILabel? yes? no? if not, why not?

Luciano Perez
  • 101
  • 1
  • 10
  • Have you confirmed that it is a change in the wrapping? Or, is it a change in the label content insets? IF it's the wrapping, you could try this `label.lineBreakStrategy = []` – DonMag Jun 20 '22 at 19:42
  • TextKit 2 includes improved line-breaking algorithms designed, so I guess this is the issue around it. lineBreakStrategy = [] does not work. – Luciano Perez Jun 21 '22 at 12:05
  • I don't have a system that I can install the Beta on, but I'm curious... Is the same "no orphans" change present in `UITextView`? – DonMag Jun 21 '22 at 19:24
  • I dont know what you mean with "no orphans" in the UITextView, what I know is that you can change the text layout from textkit 1 to textKit 2 in the textview as the image shows in the post. – Luciano Perez Jun 22 '22 at 13:16
  • 1
    Sorry... when the text wraps to leave a single word on the last line of a paragraph, that is called an "orphan." Starting in iOS 10 or 11, Apple changed `UILabel` to prevent an orphan if the label had only two lines of text. One way to get around that was to use a `UITextView` - which did not enforce that rule: https://i.stack.imgur.com/b6NZ6.png ... As you are seeing, it appears TextKit 2 ***does*** now enforce the orphan rule for > 2 lines of text in a `UILabel` - so I'm curious if it has also changed for `UITextView` (I suspect not). – DonMag Jun 22 '22 at 13:47
  • 1
    Here's a quick way to test it: https://pastebin.com/frXraWWV – DonMag Jun 22 '22 at 13:49
  • Thanks for the explanation, yes, I think the only way to solve this "issue" is to go for a UITextView. This is something we are talking about with the client. – Luciano Perez Jun 23 '22 at 09:21

0 Answers0