2

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:

enter image description here

Desired Outcome:

enter image description here

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]
dllhell
  • 1,987
  • 3
  • 34
  • 51

0 Answers0