在UITextView中插入图片
来源:互联网 发布:网络的利与弊ppt图片 编辑:程序博客网 时间:2024/06/01 07:46
在UITextView中插入图片
NSMutableAttributedString *string = [[NSMutableAttributedStringalloc] initWithAttributedString:self.textView.attributedText];
NSTextAttachment *textAttachment = [[NSTextAttachmentalloc] initWithData:nilofType:nil] ;
NSString *str = [[NSBundlemainBundle] pathForResource:@"001"ofType:@"png"];
UIImage *img = [UIImageimageWithContentsOfFile:str];
textAttachment.image = img;
NSAttributedString *textAttachmentString = [NSAttributedStringattributedStringWithAttachment:textAttachment] ;
[string insertAttributedString:textAttachmentStringatIndex:self.textView.text.length];//index为用户指定要插入图片在文本框中的位置,从0开始
self.textView.attributedText = string;
- 在UITextView中插入图片
- UITextView富文本、插入图片
- 在protel中插入图片
- 在TextView中插入图片
- 在datagridview中插入图片
- 在CSDN中插入图片
- 在TextView中插入图片
- 在EditText中插入图片
- 在canvas中插入图片
- 在Excel中插入图片
- 在csdn中插入图片
- UITextView在光标处插入字符串
- 在CSDN的文章中插入图片
- word中在指定位置插入图片
- 在RichEdit控制中插入Gif图片
- 在sqlserver中 插入和读取图片
- 在 Excel 文件中插入图片
- 怎样在latex中插入jpg图片
- linux命令crontab
- IOS 多线程初探(二) - Operation Object
- JVM调优总结(六)-分代垃圾回收详述2
- Windbg下无法显示dbgPrint输出的信息
- Python AES使用
- 在UITextView中插入图片
- Android APP权限之sharedUserId和签名
- JVM调优总结(七)-典型配置举例1
- LeetCode - Add Two Numbers
- JVM调优总结(八)-典型配置举例2
- 励志十条
- 激荡20年:IE浏览器的辉煌与落寞
- Android 权限大全(整理、更新)
- APP Icon