iOS 本地html文件传参数

self=uiwebview; 

//绝对路径

fileHtml=@"/Users/apple/Library/Application Support/iPhone Simulator/6.0/Applications/EF63CAA5-F7A7-480C-B292-A58D5688FBA7/Documents/data/page/common/detail.html?i=1213";

- (void)loadLocalHtmlFile:(NSString *)fileHtml

{

    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"file://%@",[fileHtmlstringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];

    [self loadRequest:request];

    [request release];

}

备注:直接通过fileURLWithPath参数传递不成功!!!

utf-8转码是模拟ios加载本地文件后的自动转码,使用fileURLWithPath加载普通本地文件,可通过输出NSURLRequest查看

你可能感兴趣的:(html,ios)