-3

我正在制作一个应用程序,其中我的应用程序需要使用 https URL。我想在视图(或)UIWebview 中使用 https url 显示 PDF 文件。我怎么做?请向我解释...在此先感谢。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

NSError *error;

DisplayPdfViewController *pdf=[[DisplayPdfViewController alloc]init];

[self.navigationController pushViewController:pdf animated:YES];

if (indexPath.row==0) 

{

NSURL *url=[NSURL URLWithString:@"https:sampleurl"];

 NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

[ NSURLConnection sendSynchronousRequest: urlRequest returningResponse: nil error: &error ];

NSURLRequest *request=[NSURLRequest requestWithURL:url];

[pdf.webView loadRequest:request];

//  pdf.title=[arrayList objectAtIndex:indexPath.row];

}

 else if (indexPath.row==1)

{

NSURL *url=[NSURL URLWithString:@"https: some sample url"];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

[ NSURLConnection sendSynchronousRequest: urlRequest returningResponse: nil error: &error ];

 NSURLRequest *request=[NSURLRequest requestWithURL:url];

 [pdf.webView loadRequest:request];

 //  pdf.title=[arrayList objectAtIndex:indexPath.row];

 }

else if (indexPath.row==2)

{

 NSURL *url=[NSURL URLWithString:@"https: some sample url"];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

 [ NSURLConnection sendSynchronousRequest: urlRequest returningResponse: nil error: &error ];

NSURLRequest *request=[NSURLRequest requestWithURL:url];

 [pdf.webView loadRequest:request];

//   pdf.title=[arrayList objectAtIndex:indexPath.row];

}


else if (indexPath.row==3)

{

NSURL *url=[NSURL URLWithString:@"https:some sample url"];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

[ NSURLConnection sendSynchronousRequest: urlRequest returningResponse: nil error: &error ];

 NSURLRequest *request=[NSURLRequest requestWithURL:url];

[pdf.webView loadRequest:request];

// pdf.title=[arrayList objectAtIndex:indexPath.row];

 }

}
4

1 回答 1

0

您需要手动下载网页并用于该用途loadData:MIMEType:textEncodingName:baseURL:

于 2013-08-23T10:44:43.467 回答