Reputation: 163
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
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
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!!!!!!!!!";
Upvotes: 2
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
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