获取 网址 传入 model <MVP编码>
点击事件
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
SearchbarViewController *searview = [[SearchbarViewController alloc] init];
Model *model = [[Model alloc] init];
model=self.dataSource[indexPath.row];
searview.urlString=model.url;
[self.navigationController pushViewController:searview animated:YES];
}
在需要跳转的类 声明字符串 接受网址
#import "SearchbarViewController.h"
#import <WebKit/WebKit.h>
@interface SearchbarViewController ()
@property(nonatomic,strong)UIScrollView *backView;
@end
@implementation SearchbarViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(reTurn)];
WKWebView *webView=[[WKWebView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT+49)];
NSURL *webUrl = [NSURL URLWithString:self.urlString];
//创建请求对象
NSURLRequest *requset = [NSURLRequest requestWithURL:webUrl];
[webView loadRequest:requset];
[self.view addSubview:webView];
}
-(void)reTurn
{
//pop返回
[self.navigationController popViewControllerAnimated:YES];
}
@end
偷懒专用 <- <-