I want to create like following Sample text in UILabel..
Muthu: Hi I am on the way to office..
wait for the few mins...
This type of text have UITableviewCustom cell have the UILabel.
How to create in the UILabel?
I want to create like following Sample text in UILabel..
Muthu: Hi I am on the way to office..
wait for the few mins...
This type of text have UITableviewCustom cell have the UILabel.
How to create in the UILabel?
Use the following code and include the .h and .m files from the following link "https://github.com/AliSoftware/OHAttributedLabel".
-(void)addTitleView{
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:@"Muthu: Hi I am on the way to office..wait for the few mins..."];
[attrStr setFont:[UIFont fontWithName:@"Verdana" size:16]];
[attrStr setTextColor:[UIColor whiteColor]];
[attrStr setFont:[UIFont fontWithName:@"Verdana-Bold" size:16] range:NSMakeRange(0,6)];
OHAttributedLabel *titleLabel = [[OHAttributedLabel alloc] init];
titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[titleLabel setFrame:CGRectMake(0, 0, 200, 35)];
[titleLabel setBackgroundColor:[UIColor clearColor]];
titleLabel.adjustsFontSizeToFitWidth = YES;
titleLabel.attributedText = attrStr;
titleLabel.textAlignment = UITextAlignmentJustify;
[self.view addSubview:titleLabel];
}
Use UILabels with support for attributed strings is TTTAtributedLabel or OHAttributedLabel
I use OHAttributedLabel. Refer to this ansewr for an example and use setTextBold for boldness.
You got to use NSAttributedString. There are many open source components available to do that for you. Have a look at this.