一些有用的实例
来源:互联网 发布:关系数据库的基本概念 编辑:程序博客网 时间:2024/06/03 21: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
- 一些有用的网站
- 一些有用的网址
- 一些有用的特效代码
- 一些有用的技巧
- 一些有用的联接
- iOS开发教程:Storyboard全解析-第一部分
- 手机客户端版csdn搜索
- Python 静态方法 类方法
- ASCII码表
- 开始了
- 一些有用的实例
- 策略模式(strategy)行为型模式c#简单例子
- html中inline与block的细节对比
- 开放平台之我见
- 面试一些有用的
- 大数据浅析
- 中国计算机学会推荐国际学术刊物
- _minimum_giga_scn恢复数据库一例
- 初学java——关于数组容易忽视的地方总结