簡體   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