Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saturngod/sgdownloader
downloading file with TableView
https://github.com/saturngod/sgdownloader
Last synced: about 2 months ago
JSON representation
downloading file with TableView
- Host: GitHub
- URL: https://github.com/saturngod/sgdownloader
- Owner: saturngod
- Created: 2012-07-11T10:31:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-13T03:54:58.000Z (over 11 years ago)
- Last Synced: 2024-10-31T22:50:46.058Z (about 2 months ago)
- Language: Objective-C
- Size: 169 KB
- Stars: 55
- Watchers: 9
- Forks: 30
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SGdownloader is a small library for downloading file. It supported
* Block
* Delegate
* ARCYou can use Block or Delegate for downloading the file. If you are using with TableView, you should use Delegate instead of Block.
## Demo
I put downloadManager demo with tableview cell. It's using delegate method for delete the tableviewcell.
##How to use
Put
* SGdownloader.h
* SGdownloader.mto your project.
###for using Block
SGdownloader *downloader = [[SGdownloader alloc] initWithURL:[NSURL URLWithString:@"http://myfile.com/file.jpg"] timeout:60];
[downloader startWithDownloading:(float progress,NSInteger percentage) {
//progress for progress bar
//percentage for download percentage
} onFinished:(NSData* fileData,NSString* fileName){
//use NSData to write a file or image
}onFail (NSError* error){
//on fail
}];
###for using Delegate
put SGdownloader delegate at .h file@interface progressCell : UITableViewCell
in .m file
SGdownloader *downloader = [[SGdownloader alloc] initWithURL:[NSURL URLWithString:@"http://myfile.com/file.jpg"] timeout:60];
[downloader startWithDelegate:self];
Delegate Methods are required-(void)SGDownloadProgress:(float)progress Percentage:(NSInteger)percentage;
-(void)SGDownloadFinished:(NSData*)fileData;
-(void)SGDownloadFail:(NSError*)error;
##Todo
* allow 1-5 concurrent download for 1 file (like download manager)
#Example
check downloadManager.xcodeproj . All the downloading images are using from google search result. It is using for testing purporse only.
##Log
###Version 0.2
- Allow Pause and Resume
###Version 0.1
- Allow Download with Progress