-(void) LoadLocalHtmlFile:(id)sender{
//取得欲读取档案的位置与文件名
NSString *resourcePath = [ [NSBundle mainBundle] resourcePath];
NSString *filePath = [resourcePath stringByAppendingPathComponent:@"1.html"];
// encoding:NSUTF8StringEncoding error:nil 这一段一定要加,不然中文字会乱码
NSString *htmlstring=[[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[web loadHTMLString:htmlstring baseURL:[NSURL fileURLWithPath:[ [NSBundle mainBundle] bundlePath]]];
}
IOS本地读取HTML文件内容 适合新手试试
最新推荐文章于 2023-11-01 09:21:14 发布