0

I am having a textview which contains text and list of some items.I want to display text in black color and bullets in orange color. How to do that.? Thanks in advance.

Tejasvi
  • 29
  • 4

2 Answers2

1

In swift 3.1

  let  DelevieryDateString = "●" + "This is a list item!"

    let DelevieryDateStr: NSMutableAttributedString =  NSMutableAttributedString(string: DelevieryDateString)

    DelevieryDateStr.addAttribute(NSForegroundColorAttributeName,
                                    value: UIColor.green, //color code what you want
                                    range: NSRange(
                                        location:0, // Find the location of the bullet and replace it
                                        length: 1))
lblitem.attributedText = DelevieryDateStr
Daxesh Nagar
  • 1,405
  • 14
  • 22
0

Using " • " should work for you.
Check UILabel with bullet points and Bullet list in UITextView.
For combining text with bullet list you should use NSAttributedString. Here is an example you will be interested in.

Community
  • 1
  • 1
Nitish
  • 13,845
  • 28
  • 135
  • 263
  • Thank you Nitish for your answer . I have added bullet but I want to change the color of that bullet to orange . how could I do that I can't understand.\ – Tejasvi Feb 04 '15 at 12:59
  • @Tejasvi : Welcome. Please accept the answer if it is the solution. It shall be a reference for others in future. – Nitish Feb 04 '15 at 13:00
  • @Tejasvi : Did you try NSAttributedString ? – Nitish Feb 04 '15 at 13:10