错误使用未声明的标识符webview

时间:2013-07-09 13:36:17

标签: ios objective-c

  

我在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

1 个答案:

答案 0 :(得分:1)

.h 文件

中写下此行
@property (nonatomic,retain) IBOutlet UIWebView *WebView1;

.m 文件

中写下此行
@synthesize WebView1;