ios7 获取TextView中图片信息。
来源:互联网 发布:小学生编程比赛 编辑:程序博客网 时间:2024/06/03 16:54
图文混排:
//图文混搭 NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithAttributedString:textV.attributedText]; //获取textV原来的内容信息 fatieImage = [[FaTieImage alloc]init]; fatieImage.image = image; NSAttributedString *textAttachmentString = [NSAttributedString attributedStringWithAttachment:fatieImage]; [string insertAttributedString:textAttachmentString atIndex:textV.selectedRange.location]; textV.attributedText = string; [textV setFont:[UIFont fontWithName:@"Arial" size:16]]; [textV becomeFirstResponder];
查找图片:
//找出图片 NSRange range; NSMutableArray *imgList=[[NSMutableArray alloc]init]; //图片个数 for (int i=0; i<textV.text.length; i++) { NSDictionary *dic=[textV.attributedText attributesAtIndex:i effectiveRange:&range]; FaTieImage *img=dic[@"NSAttachment"]; //FaTieImage是继承NSTextAttachment的类 if (img) { NSLog(@"有图片,位置是:%d",i); img.location=i; [imgList addObject:img]; } }这个方法有点笨,我在网上找了很久,没找到。自己写了个,先用着。
0 0
- ios7 获取TextView中图片信息。
- android textview获取图片
- PHP 获取图片信息
- Android获取图片信息
- php获取图片信息
- php获取图片信息
- Android 获取图片信息
- Android---11---TextView显示图片信息
- iOS7中读取通讯录信息授权问题
- [图像]获取图片中感兴趣区域的信息(Matlab实现)
- [图像]获取图片中感兴趣区域的信息(Matlab实现)
- 在TextView中插入图片
- 在TextView中插入图片
- 在TextView中显示图片
- 在TextView中添加图片
- Android TextView中插入图片
- Android TextView中添加图片
- 在TextView中添加图片
- Redis 集群功能说明
- Linux环境下ping命令出现“Destination host unreachable”解决方法
- Android中Service和Thread的区别
- Windows API 之一:GetUserName和GetComputerName
- HDU 5023 线段树+状压
- ios7 获取TextView中图片信息。
- linux下安装shadowsocks
- iOS开发 iOS8 适配
- 关于java'反射机制,获得类的所有方法与字段
- linux cd 命令
- Windows下安装Redis和MongoDB
- FTP命令详解
- LevelDB源码剖析之TableCache
- ORACLE高水位线