【问题标题】:iPhone/iPad WebView ExampleiPhone/iPad WebView 示例
【发布时间】:2010-07-22 00:25:35
【问题描述】:

在哪里可以找到关于如何创建和使用 UIWebView 的简单可编译示例?

任何非接口构建器示例?

【问题讨论】:

  • 干脆放弃学习Objective-C和Interface Builder。这是一个苛刻的建议,但如果你想编写一个 iPhone 应用程序,这是不可避免的。将其视为学习新语言和新视角的一种方式。

标签: objective-c iphone uiwebview


【解决方案1】:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[webView setDelegate:self];

NSString *urlAddress = @"http://www.google.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];

[self.view addSubview:webView];

【讨论】:

    【解决方案2】:
    WebView - Add the Delegate
    
    @property (strong, nonatomic) IBOutlet UIWebView *WebView;
    
    NSString *fullURL = @"http://facebook.com/";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_WebView loadRequest:requestObj];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-26
      • 1970-01-01
      • 1970-01-01
      • 2012-05-08
      • 2011-09-21
      • 2018-01-31
      • 2012-09-26
      • 1970-01-01
      相关资源
      最近更新 更多