找到要取出内容方法:
浏览器设置 -> 更多工具 -> 开发者工具 -> 手机模式(左下角 手机按钮)
点击手机图标左边那个搜索框 -> 而后点击你要隐藏的控件
选择到你要选择到的控件 -> 而后左下角代码就被选中了.
其中右下角中是这个控件对应的css代码,在其中添加一行display:none,这时这个选中的控件就被隐藏起来了.可是咱们主要经过javascript去操做这个控件javascript
最后代码以下:css
// // MainViewController.m // webview // // Created by ??? on 15/11/24. // Copyright © 2015年 ???. All rights reserved. // #import "MainViewController.h" @interface MainViewController ()<UIWebViewDelegate> @property (nonatomic,strong)UIWebView *webView; @end @implementation MainViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self webView]; } - (UIWebView *)webView{ if (!_webView) { NSString *urlStr = @"http://group.haodou.com/topic-327282.html"; self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds]; self.webView.delegate = self; self.webView.backgroundColor = [UIColor redColor]; [self.view addSubview:_webView]; NSURL *url=[NSURL URLWithString:urlStr]; NSURLRequest *request=[[NSURLRequest alloc] initWithURL:url]; [self.webView loadRequest:request]; } return _webView; } - (void)webViewDidFinishLoad:(UIWebView *)webView{ [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('main_mu_bar')[0].style.display = 'NONE'"]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end
编辑文字方法html