您的位置:首页 > 移动开发 > IOS开发

ios图文混排

2016-06-02 00:00 375 查看
NSMutableAttributedString *str=[[NSMutableAttributedString alloc] initWithString:@"fdsahfjdsafkdhafjkhadjksfhjk" attributes:nil];

NSTextAttachment *attachment=[[NSTextAttachment alloc] initWithData:nil ofType:nil];
UIImage *img=[UIImage imageNamed:@"xxx.png"];
attachment.image=img;
attachment.bounds=CGRectMake(0, -10, 20, 20);
NSAttributedString *text=[NSAttributedString attributedStringWithAttachment:attachment];

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