У меня есть два UIwebViews. Я закодировал каждого, чтобы перейти на другой URL-адрес веб-страницы. Но оба они идут к первому URL (http://test.bithumor.co/test26.php)
Вот код от просмотра controller.mСоздать отдельные UIwebViews
//
// ViewController.m
// BitHumor
//
// Created by danny rodriguez on 7/26/15.
// Copyright (c) 2015 BitDeveloping. All rights reserved.
//
#import "ViewController.h"
@interface ViewController()
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIWebView *webView2;
@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 *[email protected]"http://test.bithumor.co/test26.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.
UIWebView *webview2=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];
NSString *[email protected]"http://google.com";
NSURL *nsurl2=[NSURL URLWithString:url2];
NSURLRequest *nsrequest2=[NSURLRequest requestWithURL:nsurl2];
[webview2 loadRequest:nsrequest2];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Оба веб мнения связаны с @property, как я делаю каждый из них идут к их назначенные URL-адреса веб-страницы? (Пожалуйста, скажите мне, шаг за шагом, как я новичок в кодировании Objective-C)
[webview2 loadRequest: nsrequest2]; Я получил сообщение об ошибке «Использование необъявленного идентификатора« webview2 »: вы имели в виду« webview »?» « –
use webView и webView2 отредактировали мой ответ и удалили этот код [self.view addSubview: webview]; – prasad
Что вы имеете в виду под управлением webView и WebView 2? Я уже удалил: [self.view addSubview: webview]; Вот как это выглядит: http://i.stack.imgur.com/1JMd6.png –