繁体   English   中英

如何在UIImageView周围换行?

[英]How to wrap text around UIImageView?

我一直在对此做一些研究。 我正在尝试在图像周围包裹一些文本。

|| Some || Lets say
||Image || i want
to place the text
around here.

我知道这个问题已经被问到了,但是我找不到任何好的答案。 有任何想法吗? (我不介意文本在UIWebView中)

UIBezierPath * imgRect = [UIBezierPath bezierPathWithRect:CGRectMake(0,0,100,100)];

UIImageView *imageView= [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
imageView.image=[UIImage imageNamed:@"defaultImage"];
[self.textView addSubview:imageView];
self.textView.textContainer.exclusionPaths = @[imgRect];

如果可以使用CoreText,请按照以下教程进行操作:使用CoreText 将文字环绕在形状上

否则,您可以编写HTML,并在UIWebView上调用loadHTMLString:baseURL:。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM