<tfoot id='r1I8D'></tfoot>

      <legend id='r1I8D'><style id='r1I8D'><dir id='r1I8D'><q id='r1I8D'></q></dir></style></legend>
    1. <small id='r1I8D'></small><noframes id='r1I8D'>

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

      1. 将随机大小的图像放入 UIWebview (IOS)

        Fit image of random size into a UIWebview (IOS)(将随机大小的图像放入 UIWebview (IOS))
      2. <i id='By3Tq'><tr id='By3Tq'><dt id='By3Tq'><q id='By3Tq'><span id='By3Tq'><b id='By3Tq'><form id='By3Tq'><ins id='By3Tq'></ins><ul id='By3Tq'></ul><sub id='By3Tq'></sub></form><legend id='By3Tq'></legend><bdo id='By3Tq'><pre id='By3Tq'><center id='By3Tq'></center></pre></bdo></b><th id='By3Tq'></th></span></q></dt></tr></i><div id='By3Tq'><tfoot id='By3Tq'></tfoot><dl id='By3Tq'><fieldset id='By3Tq'></fieldset></dl></div>
            <legend id='By3Tq'><style id='By3Tq'><dir id='By3Tq'><q id='By3Tq'></q></dir></style></legend>
            • <small id='By3Tq'></small><noframes id='By3Tq'>

                <tbody id='By3Tq'></tbody>
              • <tfoot id='By3Tq'></tfoot>
                • <bdo id='By3Tq'></bdo><ul id='By3Tq'></ul>

                  本文介绍了将随机大小的图像放入 UIWebview (IOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将大图像放入 UIwebview 并保持图像比例与图像视图相同.

                  I want to fit large image into UIwebview with keeping image ratio same as image view.

                  我该怎么做?

                  我的代码如下以适合 Uiwebview 中的图像.如果图像很大,那么显示效果不好.

                  My code as follows to fit image in Uiwebview. if image is large then display is not good.

                                  CGFloat screenWidth = self.view.frame.size.width;
                                  CGFloat screenHeight = self.view.frame.size.height;
                  
                                  NSString *htmlString = [NSString stringWithFormat:@"%@", @"<html><head><meta name='viewport' content='user-scalable=yes,width=device-width'></head><body bgcolor='000000'><img src='%@' width='%f' height='%f' style='max-width:200% max-height:200%'></body></html>"];
                                  imageHTML  = [[NSString alloc] initWithFormat:htmlString, fileUrl, screenWidth, screenHeight];
                  
                          [Webview loadHTMLString:imageHTML baseURL:nil];
                          [imageHTML release];
                  

                  推荐答案

                  我用过下面的代码,效果很好.

                     NSString *imageHTML = [[NSString alloc] initWithFormat:@"%@%@%@", @"<!DOCTYPE html>"
                                                   "<html lang="ja">"
                                                   "<head>"
                                                   "<meta charset="UTF-8">"
                                                   "<style type="text/css">"
                                                   "html{margin:0;padding:0;}"
                                                   "body {"
                                                   "margin: 0;"
                                                   "padding: 0;"
                                                   "color: #363636;"
                                                   "font-size: 90%;"
                                                   "line-height: 1.6;"
                                                   "background: black;"
                                                   "}"
                                                   "img{"
                                                   "position: absolute;"
                                                   "top: 0;"
                                                   "bottom: 0;"
                                                   "left: 0;"
                                                   "right: 0;"
                                                   "margin: auto;"
                                                   "max-width: 100%;"
                                                   "max-height: 100%;"
                                                   "}"
                                                   "</style>"
                                                   "</head>"
                                                   "<body id="page">"
                                                   "<img src='",fileUrl,@"'/> </body></html>"];
                  
                                  [wview_contents loadHTMLString:imageHTML baseURL:nil];
                  

                  这篇关于将随机大小的图像放入 UIWebview (IOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Resume game cocos2d(恢复游戏 cocos2d)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)

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

                    <tfoot id='HZWD2'></tfoot><legend id='HZWD2'><style id='HZWD2'><dir id='HZWD2'><q id='HZWD2'></q></dir></style></legend>

                        • <bdo id='HZWD2'></bdo><ul id='HZWD2'></ul>
                            <tbody id='HZWD2'></tbody>

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