NSMutableArray * urlImageArray = [NSMutableArray array];
NSString *leng = [wb stringByEvaluatingJavaScriptFromString:@"var images = document.getElementsByTagName('img');images.length.toString();"];
NSLog(@"leng:%@",leng);
for (int i=0; i<[leng integerValue]; i++) {
NSString *strimage = [NSString stringWithFormat:@"var images = document.getElementsByTagName('img');images[%d].src.toString();",i];
NSString *ImageUrl = [wb stringByEvaluatingJavaScriptFromString:strimage];
[urlImageArray addObject:ImageUrl];
}
for (NSString * url in urlImageArray) {
NSLog(@"%@",url);
NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
UIImage * image = [UIImage imageWithData:data];
[_picArray addObject:image];
}
网友评论