-
(NSAttributedString )getLocationStr:(NSString)locationString{
NSMutableAttributedString *text = [NSMutableAttributedString new];
NSTextAttachment *attch = [[NSTextAttachment alloc] init];
//定义图片内容及位置和大小
attch.image = [UIImage imageNamed:@"weiba_location_ly"];
attch.bounds = CGRectMake(8, -3, 12, 14);
//创建带有图片的富文本
NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attch];
NSAttributedString *locationStr = [[NSAttributedString alloc] initWithString:locationString];
NSAttributedString *Str = [[NSAttributedString alloc] initWithString:@" "];[text appendAttributedString:string];
[text appendAttributedString:Str];
[text appendAttributedString:locationStr];
return text;
}
网友评论