English 中文(简体)
UIWebView: 根据内容调整大小/适合吗?
原标题:UIWebView : resize/fit according to the content?

我想创建一个有多种字体格式和颜色的文本区域, 所以我使用 UIWebView 。 创建并显示我的 HTML 文本没有问题, 但我想让这个视图适合内容 。

使用UITextView, 我过去常在子View 添加内容后做以下工作:

CGRect frame = myTextView.frame;
frame.size.height = myTextView.frame.size.height;
myTextView.frame = frame;

但它与UIWebView不起作用 有何建议?

最佳回答

我写了一篇简短的教程, 内容是“如何将UIWebView的高度设定为 HTML 内容的高度 。

问题回答

将其大小调整为 UIWebView 滚动视图的大小 。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签