2010-07-16 53 views

回答

0

首先创建一个基于视图的应用程序,在View中添加一个UIWebView,并在.plist中添加一个应用程序使用Wi-Fi密钥,并将其设置为YES。在视图控制器类的.h文件中作出的代码是这样的:

#import <UIKit/UIKit.h> 

@interface ClassNameHere : UIViewController { 

    UIWebView *webView; 

} 

@property (nonatomic, retain) IBOutlet UIWebView *webView; 

@end 

在.m文件,添加以下代码:

@synthesize webView; 

- (void)viewDidLoad { 
    NSString *urlString = @"http://www.google.com"; 

    //Create a URL object. 
    NSURL *url = [NSURL URLWithString:urlString]; 

    //URL Requst Object 
    NSURLRequest *webRequest = [NSURLRequest requestWithURL:url]; 

    //Load the request in the UIWebView. 
    [webView loadRequest:webRequest]; 
} 

最后,在你的笔尖文件,连接webView的出口到UIWebView。当你编译时,它应该打开Goog​​le。