<bdo id='gelVX'></bdo><ul id='gelVX'></ul>
      <tfoot id='gelVX'></tfoot>
    1. <i id='gelVX'><tr id='gelVX'><dt id='gelVX'><q id='gelVX'><span id='gelVX'><b id='gelVX'><form id='gelVX'><ins id='gelVX'></ins><ul id='gelVX'></ul><sub id='gelVX'></sub></form><legend id='gelVX'></legend><bdo id='gelVX'><pre id='gelVX'><center id='gelVX'></center></pre></bdo></b><th id='gelVX'></th></span></q></dt></tr></i><div id='gelVX'><tfoot id='gelVX'></tfoot><dl id='gelVX'><fieldset id='gelVX'></fieldset></dl></div>

      <small id='gelVX'></small><noframes id='gelVX'>

    2. <legend id='gelVX'><style id='gelVX'><dir id='gelVX'><q id='gelVX'></q></dir></style></legend>

      根据其内容计算 UIWebView 高度

      Calculate UIWebView height depending on its content(根据其内容计算 UIWebView 高度)

        <legend id='oNA2t'><style id='oNA2t'><dir id='oNA2t'><q id='oNA2t'></q></dir></style></legend>
      • <i id='oNA2t'><tr id='oNA2t'><dt id='oNA2t'><q id='oNA2t'><span id='oNA2t'><b id='oNA2t'><form id='oNA2t'><ins id='oNA2t'></ins><ul id='oNA2t'></ul><sub id='oNA2t'></sub></form><legend id='oNA2t'></legend><bdo id='oNA2t'><pre id='oNA2t'><center id='oNA2t'></center></pre></bdo></b><th id='oNA2t'></th></span></q></dt></tr></i><div id='oNA2t'><tfoot id='oNA2t'></tfoot><dl id='oNA2t'><fieldset id='oNA2t'></fieldset></dl></div>
      • <tfoot id='oNA2t'></tfoot>

            • <bdo id='oNA2t'></bdo><ul id='oNA2t'></ul>

                <small id='oNA2t'></small><noframes id='oNA2t'>

                  <tbody id='oNA2t'></tbody>
                本文介绍了根据其内容计算 UIWebView 高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个名为Announcement的类,它有一个Title(NSString),一个Publishing Date(NSString)和一个 Body(NSString 与 HTML 内容).

                I have a class named Announcement, it has a Title (NSString), a Publishing Date (NSString) and a Body (NSString with HTML content).

                我想以与电子邮件应用程序类似的方式显示它.当您阅读电子邮件时,您会看到前三个行"(发件人、收件人、标题[日期]),然后是电子邮件的内容.

                I would like to display it in a similar way like in the Email app. When you read an email you have the first three "rows" (From, To, Title[date]) and then the content of the email.

                我只想创建Title[date]"行,然后是正文.我想它是一个 UITableView,在第一个单元格上有我的 Title,在第二个单元格上有一个 UIWebView.

                I would want to create only the "Title[date]" row and then the body. I imagine that it to be a UITableView which has on the first cell my Title and on the second cell an UIWebView.

                但似乎单元格的高度与 UIWebView 的高度完全相同,所以我的问题是:

                But it seems like the cell has exactly the height of the UIWebView, so my question is this:

                如何根据我的 Body 计算我的 UIWebView 的高度?因为基本上,当你垂直滚动时,你会滚动整个 UITableView,而当你水平滚动时,你只会滚动 UIWebView 内容.

                How can calculate the height of my UIWebView depending on my Body? Because basically when you scroll vertically you scroll the whole UITableView, and when you scroll horizontally you scroll only the UIWebView content.

                谢谢

                推荐答案

                在 webview 委托方法中,试试下面的代码:

                In webview delegate method, just try with below code:

                - (void)webViewDidFinishLoad:(UIWebView *)webView{
                    [webviewTopicDesc sizeToFit];
                    [webviewTopicDesc setFrame:CGRectMake(webviewTopicDesc.frame.origin.x, webviewTopicDesc.frame.origin.y, 300.0, webviewTopicDesc.frame.size.height)];
                }
                

                在此之前,将 webview 高度设为 5.0.

                Before that, make the webview height as 5.0.

                希望对您有所帮助.

                这里可以根据字符串获取动态高度.

                Here, you can get dynamic height based on string.

                -(CGSize)getDynemicHeight:(int)pintFixWidth :(NSString *)pstrText
                {
                CGSize maximumSize=CGSizeMake(pintFixWidth, g_Max_Width);
                UIFont *myFont = [UIFont fontWithName:g_Default_Font_Name size:g_Default_Font_Size];// font used for label
                myFont=[UIFont boldSystemFontOfSize:g_Default_Font_Size];
                
                CGSize sizeS = [pstrText sizeWithFont:myFont 
                                   constrainedToSize:maximumSize 
                                       lineBreakMode:UILineBreakModeWordWrap];
                
                sizeS.height=sizeS.height+39;
                
                return sizeS;
                }
                

                这里,你必须用字体样式来固定宽度和字体大小.

                Here, you have to fix the width and font-size with font-style.

                可能对你有帮助.

                这篇关于根据其内容计算 UIWebView 高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                How to get indexPath.row of tableView which is currently being displayed?(如何获取当前正在显示的 tableView 的 indexPath.row?)
                Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                Mobile Device Management with iPhone(使用 iPhone 进行移动设备管理)
                <legend id='YGnU5'><style id='YGnU5'><dir id='YGnU5'><q id='YGnU5'></q></dir></style></legend>

                1. <tfoot id='YGnU5'></tfoot>
                    <bdo id='YGnU5'></bdo><ul id='YGnU5'></ul>

                          <tbody id='YGnU5'></tbody>
                        1. <i id='YGnU5'><tr id='YGnU5'><dt id='YGnU5'><q id='YGnU5'><span id='YGnU5'><b id='YGnU5'><form id='YGnU5'><ins id='YGnU5'></ins><ul id='YGnU5'></ul><sub id='YGnU5'></sub></form><legend id='YGnU5'></legend><bdo id='YGnU5'><pre id='YGnU5'><center id='YGnU5'></center></pre></bdo></b><th id='YGnU5'></th></span></q></dt></tr></i><div id='YGnU5'><tfoot id='YGnU5'></tfoot><dl id='YGnU5'><fieldset id='YGnU5'></fieldset></dl></div>

                          <small id='YGnU5'></small><noframes id='YGnU5'>