我在 viewcontroller.m 中有这个错误“使用未声明的标识符'webview'”。我还需要从文件“www”中调用 html 页面。
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *localFilePath = [[NSBundle mainBundle] pathForResource:@"www/index" ofType:@"html"] ;
NSURLRequest *localRequest = [NSURLRequest requestWithURL:
[NSURL fileURLWithPath:localFilePath]] ;
[webView loadRequest:localRequest] ;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
#import <UIKit/UIKit.h>
#import "ViewController.h"
@interface ViewController : UIViewController
@property (assign) IBOutlet UIWebView *WebView1;
@end