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;
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;
相关文章推荐
- Java GUI程序设计的初步上
- 关于SUID、SGID、Sticky。
- adams/car 怎么进入template builder模块
- 【系统性能优化】减少页面对公共资源Easyui的访问次数
- SDWebImage : NSURLErrorDomain - Code = 406 Overriding request headers in SDWebImage
- android ellipsize marquee 滚动文本正确配置
- Storyboard中的UIScrollView使用自动布局,使其能够滚动
- UIViewController的生命周期及iOS程序执行顺序
- UISwitch
- 【uiautomator】UiCollection
- PowerQuinsta
- [Training Video - 6] [File Reading] Making a Jar file with eclispe, Importing custom jars in SoapUI
- Request的getParameter和getAttribute方法的区别
- STL学习笔记之容器--deque(二)源码剖析
- 关于“政府和艺术”的GRE Issue原题
- STL学习笔记之容器--deque(一)
- UISlider
- iOS版本号,build号获取,根据字符串格式长短动态计算uilabel的size等
- GRE issue写作范文之实用的意义
- 雨松MOMO UGUI 之 UI的深度学习(二)