Commit 94b1f7590ff1386a90de1403e952f4bba3457b60
1 parent
ba997688
no message
Showing
1 changed file
with
25 additions
and
2 deletions
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| ... | ... | @@ -42,8 +42,28 @@ |
| 42 | 42 | return self; |
| 43 | 43 | } |
| 44 | 44 | - (NSString *)setHTMLString:(NSString *)content { |
| 45 | - NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:20px;\"><strong>%@</strong></font><p>%@</p><font color=\"#184085\">%@</font> </p>",[_dictionary objectForKey:@"title"],[_dictionary objectForKey:@"createDate"],@"来源 : 国新网"]; | |
| 46 | - NSString * htmlcontent = [NSString stringWithFormat:@"<div id=\"webview_content_wrapper\">%@<font style=\"font-size:%@px;\">%@</font></div>",htmlHeader,fontArray[fontIndex],content]; | |
| 45 | + NSString* htmlcontent = [[NSString alloc] initWithFormat: | |
| 46 | + @"<!doctype html>\n" | |
| 47 | + "<html>\n" | |
| 48 | + "<head> \n" | |
| 49 | + "<meta charset=\"utf-8\"></meta>" | |
| 50 | + "<style type=\"text/css\"> \n" | |
| 51 | + "</style> \n" | |
| 52 | + "</head> \n" | |
| 53 | + "<body>" | |
| 54 | + "<script type='text/javascript'>" | |
| 55 | + "window.onload = function(){\n" | |
| 56 | + "var $img = document.getElementsByTagName('img');\n" | |
| 57 | + "for(var p in $img){\n" | |
| 58 | + " $img[p].style.width = '100%%';\n" | |
| 59 | + "$img[p].style.height = 'auto'\n" | |
| 60 | + "}\n" | |
| 61 | + "}" | |
| 62 | + "</script>\n" | |
| 63 | + "<div id=\"webview_content\"><p><font style=\"font-size:20px;\"><strong>%@</strong></font><p>%@</p><font color=\"#184085\">%@</font></p><div><font style=\"font-size:%@px;\">%@</font></div></div>" | |
| 64 | + "</body>" | |
| 65 | + "</html>",[_dictionary objectForKey:@"title"],[_dictionary objectForKey:@"createDate"],@"来源 : 国新网",fontArray[fontIndex],content]; | |
| 66 | +// NSString * htmlcontent = [NSString stringWithFormat:@"<div id=\"webview_content_wrapper\">%@<font style=\"font-size:%@px;\">%@</font></div>",htmlHeader,fontArray[fontIndex],content]; | |
| 47 | 67 | NSLog(@"htmlcontent = %@",htmlcontent); |
| 48 | 68 | return htmlcontent; |
| 49 | 69 | } |
| ... | ... | @@ -101,6 +121,7 @@ |
| 101 | 121 | self->_newsArray = [NSArray arrayWithArray:array]; |
| 102 | 122 | [self.tableView setFrame:CGRectMake(0, [self->heightArr[self->fontIndex] floatValue], MainScreenWidth, 36 + 86 * self->_newsArray.count)]; |
| 103 | 123 | [self.scrollView setContentSize:CGSizeMake(MainScreenWidth, [self->heightArr[self->fontIndex] floatValue] + self.tableView.frame.size.height)]; |
| 124 | + self.tableView.hidden = NO; | |
| 104 | 125 | [self.tableView reloadData]; |
| 105 | 126 | } |
| 106 | 127 | } else { |
| ... | ... | @@ -284,6 +305,8 @@ |
| 284 | 305 | if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { |
| 285 | 306 | [self.tableView setSeparatorInset:UIEdgeInsetsZero]; |
| 286 | 307 | } |
| 308 | + self.tableView.hidden = YES; | |
| 309 | + | |
| 287 | 310 | |
| 288 | 311 | self.errorLabe = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 289 | 312 | self.errorLabe.backgroundColor = [UIColor clearColor]; | ... | ... |