您的位置:首页 > 产品设计 > UI/UE

UILabel中插入图片

2015-06-16 15:09 465 查看
    NSMutableAttributedString *string = [[NSMutableAttributedString
alloc]
initWithString:@"1234567" attributes:nil];
   
NSTextAttachment *textAttachment = [[NSTextAttachment
alloc] initWithData:nil
ofType:nil];

    
   
UIImage * smileImage = [UIImage
imageNamed:@"ddd.png"];
    textAttachment.image = smileImage;

    
   
NSAttributedString *textAttachmentString = [NSAttributedString
attributedStringWithAttachment:textAttachment];
    [string
insertAttributedString:textAttachmentString
atIndex:0];

   
mlbText.attributedText = string;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: