NSString * introstring = @ "Santa Barbara, Santa Monica Beach, Old Town of Santiago, Colorado Island";
Nsarray * Introarray = [introstring componentsseparatedbystring:@ ","];
UILabel * label = [[UILabel alloc]initwithframe:cgrectmake (0, self.view.frame.size.width-26, [self asktextheight: Introstring]);
Label.font = [Uifont systemfontofsize:15];
Label.text = introstring;
Label.numberoflines = 0;
Label.backgroundcolor = Uicolorfromrgb (0XF7F7F7);
[Routecell Addsubview:label];
nsmutableattributedstring * Mutstr = [Label.attributedtext mutablecopy];
for (int i = 0; i<introarray.count-1; i++) {
NSString * ssssting = introarray[i];
Nsrange Sssrang = [introstring rangeofstring:ssssting];
UIImage * Image1 = [UIImage imagenamed:@ "Detail_more_arrowback"];
Nstextattachment * Attachment1 = [[Nstextattachment alloc] init];
Attachment1.bounds = CGRectMake (0, 0, 37, 13);
Attachment1.image = Image1;
nsattributedstring * attachStr1 = [nsattributedstring attributedstringwithattachment:attachment1];
[Mutstr Replacecharactersinrange:nsmakerange (sssrang.length+sssrang.location, 1) withattributedstring:attachstr1] ;
}
Label.attributedtext = [mutstr copy];
nsmutableattributedstring *attributedstring = [Label.attributedtext mutablecopy];
Nsmutableparagraphstyle *paragraphstyle = [[Nsmutableparagraphstyle alloc] init];
[Paragraphstyle setlinespacing:16];//Adjust line spacing
[Attributedstring addattribute:nsparagraphstyleattributename Value:paragraphstyle range:NSMakeRange (0, [ Label.attributedtext length]);
Label.attributedtext = attributedstring;
[Label SizeToFit];
Effect:
Add a picture to text to achieve a graphic mix