0

Well, it is very strange for me that, NSStrikethroughStyleAttributeName doesn't working if I concatenate/ append two NSMutableAttributedString for a label.

let partTwo: NSMutableAttributedString = NSMutableAttributedString(string: "4450")

        partTwo.addAttribute(NSStrikethroughStyleAttributeName, value: 1, range: NSMakeRange(0, partTwo.length))

        cell.lbl11.attributedText = partTwo

Above code working perfect, but if I do bellow code:

let partOne: NSMutableAttributedString = NSMutableAttributedString(string: "WAS $")
        let partTwo: NSMutableAttributedString = NSMutableAttributedString(string: "4450")
        partTwo.addAttribute(NSStrikethroughStyleAttributeName, value: 1, range: NSMakeRange(0, partTwo.length))
        let concate = NSMutableAttributedString(attributedString: partOne)
        concate.append(partTwo)
        cell.lbl11.attributedText = concate


NSStrikethroughStyleAttributeName doesn't working.

I needs like below image in one single label. Is it possible?

enter image description here

Abhishek Mitra
  • 3,335
  • 4
  • 25
  • 46

0 Answers0