Code Monkey home page Code Monkey logo

hcdownload's Introduction

Usage:

HCDownloadViewController *dlvc = [[HCDownloadViewController alloc] init];
dlvc.downloadDirectory = @"/var/mobile/Library/Downloads";
dlvc.delegate = self;
[dlvc downloadURL:[NSURL URLWithString:@"http://megaupload.com/piratedSong.mp3"] userInfo:nil];

userInfo is an NSDictionary with arbitrary values, it can even be nil. However, some special keys are respected by the view controller: kHCDownloadKeyTitle corresponds to an NSString which will be used as the title of the download in the table view instead of the file name, and kHCDownloadKeyImage must correspond to an UIImage (if present) that will be displayed in the left side of the table view cell. kHCDownloadKeyFileName shall specify an NSString (if any) that contains a valid filename, to which the downloaded data is to be saved. If not present, the filename suggested by the server will be used.

To inspect the number of downloads currently in progress, use dlvc.numberOfDownloads.

To respond to download events, implement the optional delegate methods:

- (void)downloadController:(HCDownloadViewController *)vc startedDownloadingURL:(NSURL *)url userInfo:(NSDictionary *)userInfo;
- (void)downloadController:(HCDownloadViewController *)vc dowloadedFromURL:(NSURL *)url progress:(float)progress userInfo:(NSDictionary *)userInfo;
- (void)downloadController:(HCDownloadViewController *)vc finishedDownloadingURL:(NSURL *)url toFile:(NSString *)fileName userInfo:(NSDictionary *)userInfo;
- (void)downloadController:(HCDownloadViewController *)vc failedDownloadingURL:(NSURL *)url withError:(NSError *)error userInfo:(NSDictionary *)userInfo;

Enjoy!

hcdownload's People

Contributors

h2co3 avatar abizern avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.