Anamika
Anamika

Reputation: 163

Bullet in UILabel

I need one help i don't know how to implement bullet in UILabel text. I search lots of links but couldn't find the solution. Please help me. Waiting for a solution.

Thanks in advance.

Upvotes: 0

Views: 5456

Answers (5)

S Yoshida
S Yoshida

Reputation: 338

If formatting your text with bullets is a concern, I found this Stack Overflow post helpful. They show you how to create and align paragraphs containing bullets using storyboard.

Upvotes: 0

Hector
Hector

Reputation: 3907

You should take a look at AliSoftware's OHAttributedLabel. It is a subclass of UILabel that draws an NSAttributedString

try this:

#import "OHAttributedLabel.h"
#import "NSAttributedString+Attributes.h"

OHAttributedLabel *myLabel=[[OHAttributedLabel alloc]init];
[myLabel setFrame:CGRectMake(0, 0, 70, 20)];
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:@"\u2022 list item!!!"];
[attrStr setTextColor:[UIColor redColor]];
[attrStr setTextColor:[UIColor blackColor] range:NSMakeRange(0,1)]; 
myLabel.attributedText = attrStr;
[self.view addSubview:myLabel];

if you want to add just bullet than use this:

myLabel.text = @"\u2022  list item!!!!!!!!!";

List of more unicode

Upvotes: 2

mshau
mshau

Reputation: 503

hi @Anamika Try this also

   myLabel.text = @"\u25A0 This is a list item!";

and for more shapes you can chage the value from here : http://www.alanwood.net/unicode/geometric_shapes.html

Upvotes: 0

mshau
mshau

Reputation: 503

Use the Unicode code point for the bullet character in your string? Try This:

myLabel.text = @"\u2022 This is a list item!";

Upvotes: 4

WhoaItsAFactorial
WhoaItsAFactorial

Reputation: 3558

Cmd+K on a mac will insert a bullet character.

Upvotes: -1

Related Questions