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.
Asked
Active
Viewed 913 times
0
-
I think you can't do this – Tendulkar Feb 04 '15 at 11:50
-
2`NSAttributedString` with • character? – Larme Feb 04 '15 at 11:53
2 Answers
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.
-
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
-