一些有用的实例
来源:互联网 发布:淘宝睡衣退款率 编辑:程序博客网 时间:2024/05/22 04:36
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://api.flickr.com/services/rest/?method=flickr.groups.browse&api_key=b6300e17ad3c506e706cb0072175d047&cat_id=34427469792@N01&format=rest"]];
AFXMLRequestOperation *operation = [AFXMLRequestOperation XMLParserRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser) {
XMLParser.delegate = self;
[XMLParser parse];
} failure:nil];
[operation start];
2、图片的请求:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[imageView setImageWithURL:[NSURL URLWithString:@"http://i.imgur.com/r4uwx.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
3、图片商专处理,监测商专状态:
NSURL *url = [NSURL URLWithString:@"http://api-base-url.com"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"avatar.jpg"], 0.5);
NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"/upload" parameters:nil constructingBodyWithBlock: ^(id formData) {
[formData appendPartWithFileData:imageData name:@"avatar" fileName:@"avatar.jpg" mimeType:@"image/jpeg"];
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
[operation start];
4、在线流媒体请求:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://localhost:8080/encode"]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.inputStream = [NSInputStream inputStreamWithFileAtPath:[[NSBundle mainBundle] pathForResource:@"large-image" ofType:@"tiff"]];
operation.outputStream = [NSOutputStream outputStreamToMemory];
[operation start];
- 一些有用的实例
- 一些有用的实例
- 一些有用的sql语句实例
- 一些有用的sql语句实例
- 一些有用的SQL语句实例
- 一些比较有用的实例地址open网站上的
- 一些比较有用的实例应用SQL(For DBA)
- 一些有用的网址
- 一些有用的连接。
- 一些有用的网址!
- 一些有用的命令
- 一些有用的连接
- 一些有用的URL
- 一些有用的网站
- 一些有用的网址
- 一些有用的特效代码
- 一些有用的技巧
- 一些有用的联接
- 自定义权限学习(Perssion)
- linux配置静态ip 问题
- div中id与class的区别
- Android 从硬件到应用:一步一步向上爬 3 -- 硬件抽象层访问硬件驱动
- 为什么ubuntu中没有inittab文件
- 一些有用的实例
- Java中的参数传递方式
- 序列化对象
- C 语言程序设计实践 7.9 汉诺塔
- Python学习计划
- HTML:target=
- APP接口简介---PHP开发APP接口
- AFNetworking
- 1412091645-hd-ZOJ