I am trying to replicate the text highlight (Not Search Text Highlight) in my UIText View. But I am Stuck with the colouring in the linespacing as well. How Can I rectify this ?
Current situation:
Desired Outcome:
I have added the following attributes to my UiTextview's Attributed Text
For Paragraph Line Spacing I have used the following
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 10
For Other Attributes I have used the following
verseAttributes : [NSAttributedStringKey : Any] = [
NSAttributedStringKey(rawValue : NSAttributedStringKey.font.rawValue) : UIFont(name: "Helvetica", size:CGFloat(20*sizeMultiplier)) ?? 20,
NSAttributedStringKey(rawValue : NSAttributedStringKey.foregroundColor.rawValue) : UIColor.darkGray,
NSAttributedStringKey(rawValue : NSAttributedStringKey.backgroundColor.rawValue) : UIColor.blue]
NSAttributedStringKey(rawValue : NSAttributedStringKey.paragraphStyle) : paragraphStyle]
来源:https://stackoverflow.com/questions/51186667/uitextview-background-colours-linespacing-area-too