如何创建多个UIWebViews?

时间:2015-08-12 02:40:20

标签: ios objective-c uiwebview

我有UIWebView的Objective-C代码,但我不知道如何使用它来创建多个其他UIWebView

以下是ViewController.m中的代码:

#import "ViewController.h"

@interface ViewController ()

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

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];

    NSString *url=@"http://test.bithumor.co/test22.php";
    NSURL *nsurl=[NSURL URLWithString:url];
    NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];

    [webview loadRequest:nsrequest];
    [self.view addSubview:webview];

    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

如何使用此代码创建其他UIWebView以及如何在故事板中指定不同的UIWebView

0 个答案:

没有答案