0718 -- 0728 webview/博客园资料/多线程/网络请求不同方式/导航栏外观设置
来源:互联网 发布:贝叶斯网络训练 编辑:程序博客网 时间:2024/04/29 17:04
1.webView中的几个属性
1.@property(nonatomic) BOOL allowsInlineMediaPlayback
默认使NO。这个值决定了用内嵌HTML5播放视频还是用本地的全屏控制。
为了内嵌视频播放,不仅仅需要在这个页面上设置这个属性,还必须的是在HTML中的video元素必须包含webkit-playsinline属性。
2.@property(nonatomic) BOOL mediaPlaybackRequiresUserAction
在iPhone和iPad上默认使YES。这个值决定了HTML5视频可以自动播放还是需要用户去启动播放
3.@property(nonatomic) BOOL mediaPlaybackAllowsAirPlay
这个值决定了从这个页面是否可以Air Play。
webview详解 一篇博客地址
http://blog.csdn.net/lixuwen521/article/details/9293257
新浪微博API 错误代码对照表的一篇文章地址
http://blog.unvs.cn/archives/sina-api-error-code.html2.一个博客园博主
http://www.cnblogs.com/ygm900/
3 .iOS8新特性 UIPresentationController 介绍使用
http://www.15yan.com/story/jlkJnPmVGzc/
4.在iOS 8中使用UIAlertController 详细介绍
http://www.cocoachina.com/ios/20141126/10320.html
5.多线程介绍
http://www.jianshu.com/p/0b0d9b1f1f19
另一篇 http://www.jianshu.com/p/9e41f828c50c- OS开发网络篇—GET请求和POST请求
http://www.cnblogs.com/wendingding/p/3813706.html
http://www.cnblogs.com/qiqibo/archive/2012/09/03/2669371.html
http://blog.csdn.net/heyddo/article/details/37561005 - 网络请求NSURLSession代替NSConnection
http://www.jianshu.com/p/fafc67475c73
http://www.cnphp6.com/archives/64928
8.storyboard或者xib中,添加没有其中选项里没有的属性设置方法,
以给button设置圆角为例
http://www.bubuko.com/infodetail-588175.html
9.动态修改UINavigationBar的背景色
http://www.cocoachina.com/ios/20150409/11505.html - get请求 NSURLSession 方法发送
- OS开发网络篇—GET请求和POST请求
// 快捷方式获得session对象 NSURLSession *session = [NSURLSession sharedSession]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://ued.ijntv.cn/zwapp/login.php?username=%@&password=%@",self.userNameTextField.text,self.passwordTextField.text] ]; // 通过URL初始化task,在block内部可以直接对返回的数据进行处理 NSURLSessionTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { if (error) { NSLog(@"请求失败%@",error); }else { NSLog(@"登录请求成功%@", [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]); //NSLog(@"%@",data); } }]; // 启动任务 [task resume];
11.post请求
//设置请求路径 NSURL *urlPost = [NSURL URLWithString:@"http://ued.ijntv.cn/zwapp/login.php"]; //创建请求对象 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlPost]; //设置请求超时 request.timeoutInterval = 5.0; request.HTTPMethod = @"POST"; //设置请求体 拼接要提交的参数 NSString *parameter = [NSString stringWithFormat:@"username=%@&password=%@",self.userNameTextField.text,self.passwordTextField.text]; //拼接后字符串转为data,设置请求体 NSData *bodyData = [parameter dataUsingEncoding:NSUTF8StringEncoding]; //把参数添加到请求中 request.HTTPBody = bodyData; [request setValue:@"ios+android" forHTTPHeaderField:@"User-Agent"];
//发送请求
NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { if (error) { NSLog(@"请求出现错误%@",error); }else { // NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; NSLog(@"正确请求结果 原因--%@ 结果--%@ 信息--%@",dict[@"reason"],dict[@"state"],dict[@"userinfo"]); NSLog(@"-----%@",dict); //登录成功后页面跳转 if ([dict[@"state"] isEqualToString:@"success"]) { dispatch_async(dispatch_get_main_queue(), ^{//在主线程中更新UI //跳转到登录详情页面 MemberCenterViewController *memberVC = [[MemberCenterViewController alloc]initWithNibName:@"MemberCenter" bundle:nil]; memberVC.nameLabelString = dict[@"userinfo"][@"phone"]; //[self presentViewController:memberVC animated:YES completion:nil]; [self.navigationController pushViewController:memberVC animated:YES]; NSLog(@"-----%@",dict[@"userinfo"][@"phone"]); NSLog(@"label---%@",memberVC.nameLabelString); }); } } }]; [task resume];
//session 发送请求第二种方法, 使用代理方法的 需要遵守
// 使用代理方法需要设置代理,但是session的delegate属性是只读的,要想设置代理只能通过这种方式创建session NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:[[NSOperationQueue alloc] init]]; // 创建任务(因为要使用代理方法,就不需要block方式的初始化了) NSURLSessionDataTask *task = [session dataTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:parameter]]]; // 启动任务 [task resume];
//监测这种请求方式的代理方法
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler { completionHandler(NSURLSessionResponseAllow); NSLog(@"接收到服务器相应");}-(void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { NSLog(@"处理每次接收的数据");}-(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { if (error) { NSLog(@"失败 %@",error); }else { NSLog(@"成功"); }}
//另外,已被遗弃的NSConnection发送请求的方法
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) { NSError *error; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingAllowFragments) error:&error]; if (error) { NSLog(@"请求出现错误 %@",[error localizedDescription]); } NSLog(@"请求结果:%@",dic); }];
//AFNetworking 发送post的方法
#import "AFNetworking.h"#import "UIKit+AFNetworking.h"#import "AFURLResponseSerialization.h"NSString *userName = self.userNameTextField.text; NSString *password = self.passwordTextField.text; //请求的参数,即向服务器发送的参数 NSDictionary *parameters = @{@"username":userName,@"password":password}; //请求的网址,即请求的接口 NSString *urlString = @"http://ued.ijntv.cn/zwapp/login"; //请求的manager AFHTTPSessionManager *managers = [AFHTTPSessionManager manager]; managers.responseSerializer = [AFHTTPResponseSerializer serializer];/////这是特殊设置,接口类型返回值不确定时 //请求的方式 post [managers POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { //NSDictionary *backdata = responseObject; NSData *data = responseObject; NSError *err; // NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; NSDictionary *dit = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err]; NSLog(@"请求成功,服务器返回的信息 %@",[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { NSLog(@"请求失败,服务器返回的错误信息%@",error); }];
- 基于AFNetworking3.0网络封装
HYBNetWorking - 自定义iOS7导航栏背景,标题和返回按钮文字颜色
http://blog.csdn.net/mad1989/article/details/41516743
- 0718 -- 0728 webview/博客园资料/多线程/网络请求不同方式/导航栏外观设置
- The Swift Code之设置UIButton的不同方式创建,以及不同的状态和外观
- THE SWIFT CODE之设置UIBUTTON的不同方式创建,以及不同的状态和外观
- iOS 网络请求设置https连接方式
- Webview请求网络
- webView 拦截网络请求
- 网络请求+webview
- 博客园导航栏
- Flash多线程学习资料导航
- WebView加载Https请求设置
- Android get/post方式请求网络设置超时
- 仿新浪微博IOS客户端(v5.2.8)——设置导航栏外观
- WebView的使用(http协议访问网络Get和Post请求方式)
- jsonp不同的请求方式
- 网络请求的方式
- Android 网络请求方式
- Android网络请求方式
- MS-DOS方式窗口外观设置
- 比特币协议是怎样工作的(上)
- 29.Your database instance is configured with automatic undo management and the UNDO_RETENTION
- c/c++ 数组和指针的一些不同之处
- 嵌入式C语言实战开发详解(三)
- angularjs/ionic $resource 出现 preflight的解决方案
- 0718 -- 0728 webview/博客园资料/多线程/网络请求不同方式/导航栏外观设置
- BestCoder 2nd Anniversary HDU5719 Arrange
- Hadoop集群配置之后浏览器无法访问问题
- 比特币协议是怎样工作的(下)
- java语言基础入门——类的介绍
- UMLOG: (ERROR) Umeng event's keys and values must be string ,key's max length 128 and value's max le
- 链接 skyeye-1.3.5 的时候出现 /usr/bin/ld: cannot find -lltdl
- 索引关键字的选取原则
- android在genymotion上使用ffmpeg crash解决办法