在UIWebView中显示本地网页 [英] Display a local web page in a UIWebView
问题描述
我想在 UIWebView
中显示本地网页。本地网页是一个 PHP
文件,并存储在支持文件文件夹中,然后创建一个文件夹我称为webpages。我试过这个代码,但它不工作。
@synthesize web;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString * path = [[NSBundle mainBundle] pathForResource:@indexofType:@phpinDirectory:@web];
NSURL * url = [NSURL fileURLWithPath:path];
NSURLRequest * request = [NSURLRequest requestWithURL:url];
[web loadRequest:request];
[web setDelegate:self];
[web loadRequest:request];
}
由于 I am trying to display a local web page in a
You can not load 这篇关于在UIWebView中显示本地网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! PHP
需要服务器运行,因此 UIWebView
中的UIWebView
. The local web page is a PHP
file and stored in the Supporting Files folder then a folder I created called webpages. I tried this code but it doesn't work.@synthesize web;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"php" inDirectory:@"web"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[web loadRequest:request];
[web setDelegate:self];
[web loadRequest:request];
}
PHP
file in UIWebView
, Because PHP
needs server to run.