ios - 处理事件内容 UIWebview 变化
<p><p>我使用 UIWebview 撰写邮件内容<br/>
UIWebview 包含内容:</p>
<pre><code><html>
<body>
<div id="content" contenteditable="true" style="font-family: Helvetica; margin-top:15px;">
</div>
</body>
</html>
</code></pre>
<p>我需要处理事件内容 UIWebview 更改来调整 UIWebview 框架的大小吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以尝试使用 KVO:</p>
<pre><code>// Put this where you create your UIWebView
;
// Put this somewhere in the same file
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if( ) {
// Ensure the web view can fit its content
self.webView.frame = (CGRect) {
self.webView.frame.origin,
self.webView.scrollView.contentSize
};
}
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 处理事件内容 UIWebview 变化,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/18028918/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/18028918/
</a>
</p>
页:
[1]