iOS native如何获取web界面的title、image等

获取web界面的title

UILabel* titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont systemFontOfSize:14];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.text = [_Webview stringByEvaluatingJavaScriptFromString:@"document.title"];
    // 改变标题
    self.navigationItem.titleView = titleLabel;

获取web界面的image


 NSString *articleImageUrl = [_webView stringByEvaluatingJavaScriptFromString:@"document.images[0].src"];  
       NSLog(@"imageurl===%@",articleImageUrl);

你可能感兴趣的:(iOS native如何获取web界面的title、image等)