- (void)viewDidLoad {
專注于為中小企業(yè)提供網(wǎng)站制作、成都做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)內(nèi)鄉(xiāng)免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了千余家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"圖片新聞";
//新建網(wǎng)頁視圖
webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
//網(wǎng)頁視圖自適應(yīng)屏幕尺寸
webView.scalesPageToFit = YES;
//設(shè)置代理
webView.delegate = self;
[self.view addSubview:webView];
//加載百度
// //創(chuàng)建request對象
// NSMutableURLRequest *mResquest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]];
// //網(wǎng)頁控件加載一個
// [webView loadRequest:mResquest];
//初始化風(fēng)火輪
UIActivityIndicatorView *ac = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:ac];
self.navigationItem.rightBarButtonItem = rightItem;
[self _loadData];
}
- (void)_loadData{
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"news" ofType:@"html"];
NSError *error = nil;
NSString *str = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error];
NSDictionary *jsonData = [ReturnJson showJson:news_detail];
NSString *title = [jsonData objectForKey:@"title"];
NSString *source = [jsonData objectForKey:@"source"];
NSString *time = [jsonData objectForKey:@"time"];
NSString *author = [jsonData objectForKey:@"author"];
NSString *content = [jsonData objectForKey:@"content"];
NSString *htmlStr = [NSString stringWithFormat:str,title,source,time,content,author];
[webView loadHTMLString:htmlStr baseURL:nil];
}
#pragma mark-UIWebViewDelegate
//開始加載
- (void)webViewDidStartLoad:(UIWebView *)webView{
UIActivityIndicatorView *ac = (UIActivityIndicatorView *)self.navigationItem.rightBarButtonItem;
[ac startAnimating];
}
//結(jié)束加載
- (void)webViewDidFinishLoad:(UIWebView *)webView{
UIActivityIndicatorView *ac = (UIActivityIndicatorView *)self.navigationItem.rightBarButtonItem;
[ac stopAnimating];
}
//加載出錯
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務(wù)器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨有T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務(wù)器買多久送多久。