downloading file with TableView
Objective-C
Switch branches/tags
Nothing to show
Latest commit 14c70ea May 13, 2013 @saturngod saturngod fixed demo code
Permalink
Failed to load latest commit information.
SGdownloadManager version 0.2 Jan 4, 2013
downloadManager.xcodeproj fixed demo code May 13, 2013
downloadManager fixed demo code May 13, 2013
README.md update read me Jan 4, 2013

README.md

SGdownloader is a small library for downloading file. It supported

  • Block
  • Delegate
  • ARC

You 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.m

to 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 <SGdownloaderDelegate>

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