如图所示,需要实现点击一个按钮,跳转到指定网页:
-(void)pushBtnCellClickDeleate{ NSLog(@"跳转"); //在APP内部打开指定网页 UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]; NSURL *url = [NSURL URLWithString:@"https://www.baidu.com/"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [myWebView loadRequest:request]; [self.view addSubview:myWebView]; //在APP外部浏览器中打开指定网页(一般默认跳转苹果自带Safari浏览器) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.baidu.com/"]]; }
原文地址:https://www.cnblogs.com/liuzhi20101016/p/11778289.html
时间: 2024-09-30 05:09:59