在加载webView的时候怎么切换地址加载
来源:互联网 发布:原味丝袜淘宝店铺 编辑:程序博客网 时间:2024/05/29 10:18
@interface ViewController ()<UIWebViewDelegate>
@property (nonatomic,strong) UIWebView *webView;
@property (nonatomic,strong) NSString *str;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 68, 100, 40);
button.backgroundColor = [UIColor redColor];
[button addTarget:self action:@selector(updataWebView) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
self.str = @"http://www.taobao.com";
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 68)];
[self.view addSubview: self.webView];
self.webView.delegate = self;
[self loadWebView];
// Do any additional setup after loading the view, typically from a nib.
}
//点击按钮重新加载地址
-(void)updataWebView{
self.str = @"http://www.baidu.com";
[self loadWebView];
}
-(void)loadWebView{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.str] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:1];
[self.webView loadRequest:request];
}
@property (nonatomic,strong) UIWebView *webView;
@property (nonatomic,strong) NSString *str;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 68, 100, 40);
button.backgroundColor = [UIColor redColor];
[button addTarget:self action:@selector(updataWebView) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
self.str = @"http://www.taobao.com";
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 68)];
[self.view addSubview: self.webView];
self.webView.delegate = self;
[self loadWebView];
// Do any additional setup after loading the view, typically from a nib.
}
//点击按钮重新加载地址
-(void)updataWebView{
self.str = @"http://www.baidu.com";
[self loadWebView];
}
-(void)loadWebView{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.str] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:1];
[self.webView loadRequest:request];
}
0 0
- 在加载webView的时候怎么切换地址加载
- WebView 加载HttpS 的地址,
- Android--当webview加载网页的时候在标题栏上显示加载进度
- Android--当webview加载网页的时候在标题栏上显示加载进度
- Android--当webview加载网页的时候在标题栏上显示加载进度
- webview加载网页的时候在标题栏上显示加载进度
- Android--当webview加载网页的时候在标题栏上显示加载进度
- 1、当webview加载网页的时候在标题栏上显示加载进度
- andriod webview加载地址
- webview加载网页地址
- webview加载时候弹出进度条
- webView 加载链接的时候status bar 开启动画
- ios 加载webView页面的时候,参数值为中文
- 关于在WebView监听Url的加载
- 在Page_Load加载的时候首先加载用户控件
- 171206之在加载数据的时候加载操作
- 怎么修改kernel的加载地址和运行地址
- WebView的加载网页
- Centos是否安装桌面的选择
- Java环境变量配置
- 机器学习(五):Bagging与Boosting
- super用法详解
- 初始SpringMVC
- 在加载webView的时候怎么切换地址加载
- 查看android分区信息
- springboot初学 摘记
- golang之flag简单使用方法
- android studio 中 java.lang.NoClassDefFoundError:retrofit2.Retrofit$Builder错误解决
- 0930 视频边下边播/蓝牙库/阿里博客/afnetworking详细/小程序工具
- Git 常用命令详解
- 第五周项目三
- git提交命令行