
网络
文章平均质量分 74
bin236
这个作者很懒,什么都没留下…
展开
-
GCD
GCD创建多线程//串行并行指将耗时操作让多个线程去做//创建队列,标签是hello,参数填NULL为串行队列dispatch_queue_t queue = dispatch_queue_create("hello", NULL);//参数不同是并发队列dispatch_queue_t queue1 = dispatch_queue_create("hello",原创 2016-03-05 07:49:11 · 482 阅读 · 0 评论 -
GET和POST请求
#pragma mark----创建GET请求- (void)getMethod{ NSString *username = @"123456"; NSString *password = @"123456"; //用户名和密码在同一个url(用户名和密码不能为中文,有中文需要转译) NSString *string = [NSString string原创 2016-03-07 17:24:36 · 318 阅读 · 0 评论 -
(有码)创建单例
#import "Person.h"//全局的静态变量,要创建的单例类型的static Person *person;@implementation Person//快速创建方式+ (id)person{ if (person == nil) { /** * dispatch_once的作用正如其名,对于某个任务执行一次原创 2016-03-09 20:14:33 · 243 阅读 · 0 评论 -
获取文件路径
iphone沙箱模型的有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么.documents,tmp,app,Library。(NSHomeDirectory()),手动保存的文件在documents文件里Nsuserdefaults保存的文件在tmp文件夹里 1、Documents 目录:您应该将所有de应用程序数据文件写入到这个目录原创 2016-03-09 21:33:22 · 359 阅读 · 0 评论 -
(有码)NSURLSession
NSURLSession下载,默认将下载的任务保存在tmp下,如果回调方法什么都没做,tmp文件会自动删除基础: 使用单例sessionNSURL *url = [NSURL URLWithString:@"urlstring"]; //创建session NSURLSession *session = [NSURLSession sharedSession];原创 2016-03-12 21:13:58 · 44121 阅读 · 0 评论 -
(有码)NSURLConnection大文件下载
#import "ViewController.h"@interface ViewController ()//总长度@property (nonatomic, assign) long long totalLength;//传输数据@property (nonatomic, strong) NSMutableData *dataM;//写入路径@property原创 2016-03-13 10:41:46 · 1777 阅读 · 0 评论 -
系统地图使用
系统地图使用CoreLocation框架创建一个管理类CLLocationManager设置管理类的代理1.定位开始定位(start)代理方法中获取当前经纬度(CLLocation对象Coordinate:latitude longitude)2.地理编码和反编码(定位到经纬度)place mark—>CLPlacemark—>CLLocation原创 2016-04-06 16:13:50 · 384 阅读 · 0 评论 -
(有码)NSOperation
NSOperation//创建操作(单独创建操作要调用start) NSOperation *invocation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(downloadImage) object:nil];//开始操作(不添加到队列,是在主线程运行) [in原创 2016-03-05 20:14:07 · 374 阅读 · 0 评论 -
用AFN上传图片
图片上传时必要将图片进行压缩,不然会上传失败上传一张图片[manager POST:urlString parameters:params constructingBodyWithBlock:^(id_Nonnull formData) {//使用日期生成图片名称NSDateFormatter *formatter = [[NSDateFormatter all转载 2016-07-04 15:37:39 · 367 阅读 · 0 评论