firstLineHeadIndent behaving differently on second line in ios14 compared to ios13

Viewed 19

I need display a bulleted list with some user created data, while constructing it with NSAttributedString, I found out that the display is different between ios13 and ios14, and I actually want the ios13 display.

Simplified it to the following code:

let full = NSMutableAttributedString()
    
let ps1 = NSMutableParagraphStyle()
ps1.firstLineHeadIndent = 10
full.append(NSAttributedString(string: "\u{2022}\t", attributes: [.paragraphStyle: ps1]))
    
let ps2 = NSMutableParagraphStyle()
full.append(NSAttributedString(string: "123", attributes: [.paragraphStyle: ps2]))
    
let ps3 = NSMutableParagraphStyle()
full.append(NSAttributedString(string: "\u{2029}", attributes: [.paragraphStyle: ps3]))
    
let ps4 = NSMutableParagraphStyle()
ps4.firstLineHeadIndent = 10
full.append(NSAttributedString(string: "\u{2022}\t", attributes: [.paragraphStyle: ps4]))
    
let ps5 = NSMutableParagraphStyle()
full.append(NSAttributedString(string: "456", attributes: [.paragraphStyle: ps5]))

As can be seen in the screenshot below, on ios14, there's extra padding/indent on the second line. The display on ios13 is what I wanted. How do I achieve it?

enter image description here

0 Answers
Related