UITextView 与文本和图像相结合



我有这个UIScrollView,里面有图像,所有图像都是30x30。我在滚动视图下还有一个UITextView。我想做的是编辑文本视图,写一些文本,而不是将图像拖到文本视图中,它会添加到文本之后(如表情符号)。

怎么可能?

您可以将UIImageView添加为UITextView的子视图。例如,创建一个带有图像的图像视图:

UIImageView *imageView = [[UIImageView alloc] initWithImage:yourImage];
[imageView setFrame:yourFrame];
[yourTextView addSubview:imageView];

这是源代码可能对您有所帮助:
https://github.com/HansPinckaers/GrowingTextView
https://github.com/enormego/EGOTextView
https://www.cocoacontrols.com/controls/imgglyph
https://www.cocoacontrols.com/controls/secoretextviewhttp://ios-blog.co.uk/featured-posts/ios-5-rich-text-editing-series/

最新更新