项目中用到的一些第三方库
来源:互联网 发布:怎样删除kingroot软件 编辑:程序博客网 时间:2024/06/02 12:17
1.ASIHTTPRequest
虽然ASIHttpRequest已经很久没更新了,现在大家都在用AFNetWork,以前用习惯了,这次项目中用到了ASI断点下载的功能
//初始化Documents路径 NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; //初始化临时文件路径 NSString *folderPath = [path stringByAppendingPathComponent:@"temp"]; //创建文件管理器 NSFileManager *fileManager = [NSFileManager defaultManager]; //判断temp文件夹是否存在 BOOL fileExists = [fileManager fileExistsAtPath:folderPath]; if (!fileExists) {//如果不存在就创建,因为下载时,不会自动创建文件夹 [fileManager createDirectoryAtPath:folderPath withIntermediateDirectories:YES attributes:nil error:nil]; } //初始下载路径 NSURL *url = [[NSURL alloc]initWithString:urlString]; //设置下载路径 pdfRequest = [[ASIFormDataRequest alloc] initWithURL:url]; //设置ASIHTTPRequest代理 pdfRequest.delegate = self; //初始化保存文件路径 NSString *savePath = [folderPath stringByAppendingPathComponent:[NSString stringWithFormat:@"test.pdf"]]; //初始化临时文件路径 NSString *tempPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"temp/test.pdf"]]; //设置文件保存路径 [pdfRequest setDownloadDestinationPath:savePath]; //设置临时文件路径 [pdfRequest setTemporaryFileDownloadPath:tempPath]; //设置进度条的代理, [pdfRequest setDownloadProgressDelegate:self]; //设置是是否支持断点下载 [pdfRequest setAllowResumeForFileDownloads:YES]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].letterId forKey:@"letterId"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].userId forKey:@"userId"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].archGroup forKey:@"archGroup"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].archVol forKey:@"archVol"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].archType forKey:@"archType"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].archStart forKey:@"archStart"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].tableTag forKey:@"tableTag"]; [pdfRequest setPostValue:[UserSingleton shareUserSingleton].status forKey:@"status"]; [pdfRequest startAsynchronous];
其中delegate方法如下:
//下载之前获取信息的方法,主要获取下载内容的大小- (void)request:(ASIHTTPRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders{ [myTableView reloadData]; NSLog(@"didReceiveResponseHeaders-%@",[responseHeaders valueForKey:@"Content-Length"]);}//下载完成执行的方法- (void)requestFinished:(ASIHTTPRequest *)request{ //初始化网页所在的本地路径 NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:[NSString stringWithFormat:@"test.pdf"]]; NSURL *url = [NSURL fileURLWithPath:path]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; [myWebView loadRequest:urlRequest]; [progressView removeFromSuperview]; myWebView.frame = CGRectMake(0, 0, 320, [UIScreen mainScreen].bounds.size.height - 64 -80);}//下载失败- (void)requestFailed:(ASIHTTPRequest *)request{ [ALToastView toastInView:self.view withText:@"下载pdf失败"];}//下载进度- (void)setProgress:(float)newProgress{ NSLog(@"%f",newProgress); [progressView setProgress:newProgress animated:YES];}
2.SWTableViewCell
SWTableviewCell,cell滑动可以出现多个编辑按钮,效果如图:
这个第三方库的下载地址:https://github.com/CEWendel/SWTableViewCell
需要说一下的就是,它有很多版本,目前发现只有0.2.7版本支持IOS6.0
0 0
- 项目中用到的一些第三方库
- 开发中用到的一些第三方
- iOS开发中用到的一些第三方库
- 查找.net项目中用到的第三方库 - 心得
- iOS 项目中用到的一些 iOS 开源库和第三方组件
- iOS 项目中用到的一些 iOS 开源库和第三方组件
- iOS 项目中用到的一些 iOS 开源库和第三方组件
- 开发中用到的第三方库
- 开发中用到的一些第三库,和值得研究的第三方库及目标
- 分享一下我目前所在公司 iOS 项目中用到的一些 iOS 开源库和第三方组件,
- linux下将程序中用到的第三方库编译到自己的程序中
- Android开发中用到的第三方框架汇总
- 项目中用到的一些开源
- 项目中用到mobiscroll的一些心得
- 好书app中用到的常用第三方库的总结
- 第三方库的使用,不引入到项目中
- VSS源代码管理应该怎么样对bin目录及项目中用到的第三方组件进行管理?
- codeblocks中用第三方库
- 对exists用法的祥述
- 弹出框固定定位
- java各种配置
- Model-View-Controller(mvc)
- Cocos2d-x物理引擎世界的使用
- 项目中用到的一些第三方库
- css字体中 中文字体的英文表示法
- unity模型动画资源相关
- POJ-2976-Dropping tests
- 只能用GUEST用户访问共享的解决办法
- [转]Android系统中查看某个应用当前流量的方法
- Json的传递与解析
- Linux时间子系统之六:高精度定时器(HRTIMER)的原理和实现
- web项目分离记录