【问题标题】:How to load an .rtfd.zip file into an iPad UIWebView如何将 .rtfd.zip 文件加载到 iPad UIWebView
【发布时间】:2010-07-18 14:04:30
【问题描述】:

我有一个 iPad UIWebView,它必须显示一些 rtfd.zip 文件。我尝试这样做:

-(void) viewWillAppear:(BOOL)animated {

[self loadFile:string];
}
- (void)loadFile:(NSString*)file
{
NSString* resourcePath = [[NSBundle mainBundle] bundlePath];
NSString* sourceFilePath = [resourcePath stringByAppendingPathComponent:file];
NSURL* url = [NSURL fileURLWithPath:sourceFilePath isDirectory:NO];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[webview loadRequest:request];
[resourcePath release];
}

但我只得到一个空白页。插座肯定连接正确 - UIWebView 可以加载谷歌主页。

我做错了什么? 提前致谢!

【问题讨论】:

    标签: ipad uiwebview


    【解决方案1】:

    尝试用这个,我用这个得到了输出,

        - (void)loadFile:(NSString*)file    {
    
            UIWebView *webview=[[UIWebView alloc] init];
    
            NSString *FullstrURL=[[NSBundle mainBundle] pathForResource:file 
                                                                 ofType:@"html" ];
            NSLog(@"HTML String = %@",FullstrURL);
           [webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:FullstrURL]]];
    
     }
    

    【讨论】:

      猜你喜欢
      • 2011-06-06
      • 2011-10-27
      • 2014-09-06
      • 2012-09-20
      • 1970-01-01
      • 2012-03-17
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      相关资源
      最近更新 更多