如何在UIImageView周围包装文本?

问题描述 投票:1回答:2

我一直在研究这个问题。我正试图在图像周围包裹一些文字。

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

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

ios objective-c cocoa-touch text textwrapping
2个回答
1
投票

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];

0
投票

如果您对使用CoreText感到满意,请遵循以下教程:Wrapping text around a shape with CoreText

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

© www.soinside.com 2019 - 2024. All rights reserved.