- A simple encapsulation of NSURLConnection files to download.
GitHub:QianChia | Blog:QianChia(Chinese)
pod 'QConnectionDownloader'
- Drag all source files under floder
QConnectionDownloader
to your project. - Import the main header file:
#import "QConnectionDownloader.h"
-
Start Download
[[QConnectionDownloader defaultDownloader] q_downloadWithURL:url progress:^(float progress) { dispatch_async(dispatch_get_main_queue(), ^{ [button q_setButtonWithProgress:progress lineWidth:10 lineColor:nil backgroundColor:[UIColor yellowColor]]; }); } successed:^(NSString *targetPath) { NSLog(@"successed:%@", targetPath); } failed:^(NSError *error) { NSLog(@"failed:%@", error); }];
-
Pause Download
[[QConnectionDownloader defaultDownloader] q_pauseWithURL:url];
-
Cancel Download
[[QConnectionDownloader defaultDownloader] q_cancelWithURL:url];