UIWebView网页视图
来源:互联网 发布:ubuntu kylin社区 编辑:程序博客网 时间:2024/06/05 15:19
#import"ViewController.h"
@interfaceViewController()<UIWebViewDelegate>
@property(retain)UIWebView* webView;
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//按钮上一页还有刷新
[selfMyButton];
//创建网页视图
[selfWebpage];
}
-(void)Webpage
{
//创建网页视图
_webView = [[UIWebViewalloc]initWithFrame:CGRectMake(0,0, [UIScreenmainScreen].bounds.size.width, [UIScreenmainScreen].bounds.size.height)];
_webView.backgroundColor= [UIColorredColor];
[self.viewaddSubview:_webView];
//设置代理
_webView.delegate=self;
//创建百度的url链接
NSURL* url = [NSURLURLWithString:@"https://www.baidu.com"];
//创建URL请求
NSURLRequest* request = [NSURLRequestrequestWithURL:url];
//webView开始请求数据
[_webViewloadRequest:request];
}
-(void)MyButton
{
//上一页
self.navigationItem.leftBarButtonItem= [[UIBarButtonItemalloc]initWithTitle:@"上一页"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(leftAction:)];
//刷新
self.navigationItem.rightBarButtonItem= [[UIBarButtonItemalloc]initWithTitle:@"刷新"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(rightAction:)];
}
-(void)leftAction:(UIBarButtonItem*)Myleft
{
[_webViewgoBack];
}
-(void)rightAction:(UIBarButtonItem*)Myright
{
[_webViewreload];
}
#pragma mark- UIWebViewDelegate
- (void)webViewDidStartLoad:(UIWebView*)webView
{
NSLog(@"开始请求");
}
- (void)webViewDidFinishLoad:(UIWebView*)webView
{
NSLog(@"请求成功结束");
}
- (void)webView:(UIWebView*)webView didFailLoadWithError:(NSError*)error
{
NSLog(@"请求失败");
NSLog(@"error:%@",error);
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- UIWebView网页视图
- UIWebView网页视图
- IOS UIWebView 网页视图
- UIWebView网页视图
- IOS UIWebView 网页视图
- UIWebView网页视图
- UIWebView网页视图
- UIWebView网页视图
- IOS开发-UIWebView网页视图
- OCUI界面设计:网页视图 UIWebView
- UIWebView网页视图—IOS开发
- UIWebView网页视图—IOS开发
- UIWebView网页视图—iOS开发
- UIWebView网页视图—IOS开发
- UIWebView网页视图—IOS开发
- iOS UIWebView 网页视图的应用
- ios学习之UIWebView网页视图
- UIWebView网页视图—IOS开发
- 简单博弈 之江学院 F qwb has a lot of Coins
- LintCode 161-旋转图像
- lubuntu14.04右下角没有网络管理的解决方法
- Hibernate中Criteria的完整用法
- list动态remove处理并发异常ConcurrentModificationException 问题
- UIWebView网页视图
- Linux I/O 调度
- fastjson 属性大写问题
- 面--经集合1
- 最简单的Android项目(NDK命令行编译)
- Java 反斜杠 斜杠 编译 转换
- ArrayList底层实现源码解读
- discuz取消登录密码连续错误限制
- Spring 学习(1)