${title}
${source}
${content}
- (void) showDetail:(NSMutableArray *)dataArray
{
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSLog(@"-=-=%@",resourcePath);
NSString *filePath =[resourcePath stringByAppendingPathComponent:@"detailpage.html"];
NSString *htmlstring=[[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
NSLog(@"-=-=---%@",htmlstring);
//根据关键字替换
NSString *newTitle = [htmlstring stringByReplacingOccurrencesOfString:@"${title}" withString:[dataArray objectAtIndex:0]];
NSString *newSource =[newTitle stringByReplacingOccurrencesOfString:@"${source}" withString:[dataArray objectAtIndex:1]];
NSString *str;
if ([dataArray count]==3) {
str = [[dataArray objectAtIndex:2] stringByReplacingOccurrencesOfString:@" " withString:@" "];
}else{
str = [@"此内容为空 " stringByReplacingOccurrencesOfString:@" " withString:@" "];
}
// NSString *replace = [NSString stringWithFormat:@""""];
NSString *newContent = [newSource stringByReplacingOccurrencesOfString:@"${content}" withString:str];
// newContent = [newContent stringByReplacingOccurrencesOfString:@"" withString:@""="" ]
newContent = [newContent stringByReplacingOccurrencesOfString:@"width=\"640" withString:@"width=\"300"];
newContent = [newContent stringByReplacingOccurrencesOfString:@"height=\"480" withString:@"height=\"225"];
NSLog(@"mewcont =%@",newContent);
disPlayWebView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320,[[UIScreen mainScreen] bounds].size.height - 64)];
disPlayWebView.delegate = self;
NSString *path1 = [[NSBundle mainBundle] resourcePath];
NSURL *baseURL = [NSURL fileURLWithPath:path1];
[disPlayWebView loadHTMLString:newContent baseURL:baseURL];
[self.view addSubview:disPlayWebView];
[disPlayWebView release];
[indicatorView stopAnimating];
[htmlstring release];
}
2013-08-30 18:15:57.110 Hq88Project[3093:c07] -=-=/Users/hq88/Library/Application Support/iPhone Simulator/6.0/Applications/A223E633-DFB4-434A-984C-7C05CA045669/Hq88Project.app
2013-08-30 18:16:17.968 Hq88Project[3093:c07] -=-=---
${content} ${title}
${source}
(gdb)