Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html UILabel显示NSAttributed字符串,大图像超出范围_Html_Ios_Uilabel_Nsattributedstring - Fatal编程技术网

Html UILabel显示NSAttributed字符串,大图像超出范围

Html UILabel显示NSAttributed字符串,大图像超出范围,html,ios,uilabel,nsattributedstring,Html,Ios,Uilabel,Nsattributedstring,我有一个显示HTML文本的UILabel。原始HTML文本首先转换为NSAttributedString,然后显示在UILabel中 我面临的问题是HTML中的大尺寸图像超出了UILabel的范围。HTML中的对象应该进行缩放,以适应UILabel的范围,但它们不会 我怎样才能解决这个问题 JS小提琴参考: 编辑(2015-12-15): 我尝试用以下包装器代码包装HTML文本,效果良好: <style>.img_wrapper img {width:100%;}</style

我有一个显示HTML文本的
UILabel
。原始HTML文本首先转换为
NSAttributedString
,然后显示在
UILabel

我面临的问题是HTML中的大尺寸图像超出了
UILabel
的范围。HTML中的
对象应该进行缩放,以适应
UILabel
的范围,但它们不会

我怎样才能解决这个问题

JS小提琴参考:

编辑(2015-12-15):

我尝试用以下包装器代码包装HTML文本,效果良好:

<style>.img_wrapper img {width:100%;}</style><div class="img_wrapper" style="width: 250px;">[INSERT_HTML_TEXT_HERE]</div>
.img\u包装器img{宽度:100%;}[在此处插入HTML\u文本]

但是,它将图像缩放到250px的宽度,从而在右侧显示额外的空白。我希望图像根据
UILabel
宽度(在不同的设备和方向上不同)动态重新缩放/调整大小。

尝试将
clipsToBounds
设置为
是?
它已经这样做了,我不想这样做。@Mustafa我遇到同样的问题,你已经解决了吗?是的,我已经给出了我的解决方案。我包装了HTML文本。