gpt4 book ai didi

ios - 键入时如何更改 UIWebview 高度?

转载 作者:行者123 更新时间:2023-12-01 16:46:32 26 4
gpt4 key购买 nike

我正在使用 UIWebView用于创建富文本编辑器。此 Web View 放置在 UITableView 的自定义单元格中。

在 webview 中键入时,我需要更改单元格大小。我想在打字时获得 webview 的高度。 webview 内部没有滚动。

这是webview初始内容,

NSString* plainContent = @"Edit here.....";
NSString* htmlContentString = [NSString stringWithFormat:
@"<html>"
"<body>"

"<div id=\"content\" contenteditable=\"true\" style=\"font-family: Arial\">"
"%@"
"</div>"

"</body></html>", plainContent];

[_webView loadHTMLString:htmlContentString baseURL:nil];

如何更改 UIWebView打字时的高度?

最佳答案

因为 UIWebView 是 UITableViewCell 的 subview ,如果你想增加 webview 的大小,你必须增加 UITableView 的大小,请看这个线程,这更接近你想要的。

Can the height of a UITableViewCell be changed without reloading the table view?

increase uitableviewcell height simultaneously increasing the inner UITextView

谢谢。

关于ios - 键入时如何更改 UIWebview 高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19564295/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com