Latest | 0.3.0 |
---|---|
Homepage | https://github.com/dougdiego/DDLicenseViewController |
License | MIT |
Platforms | ios 7.0, requires ARC |
Authors |
Usage
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- iOS 7.0 or later
- CocoaPods
Installation
DDLicenseViewController is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod "DDLicenseViewController"
Usage
Objective-C
// Load Licenses1 from a plist
NSString *path = [[NSBundle mainBundle] pathForResource: @"Licenses1" ofType:@"plist"];
NSArray * licenses = [[NSArray alloc] initWithContentsOfFile:path];
NSArray * ddLicenses = [DDLicense licenseArrayFromDictionaryArray: licenses];
DDLicensesViewController * vc = [[DDLicensesViewController alloc] init];
vc.title = @"Licenses";
vc.licenses = ddLicenses;
// Optional: license list font
vc.licenseListFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:17];
// Optional: license font
vc.licenseFont = [UIFont fontWithName:@"Courier" size:17];
// Add close button to navigation bar
vc.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self
action:@selector(closeButtonAction:)];
// Put DDLicensesViewController in a UINavigationController and show
UINavigationController * nvc = [[UINavigationController alloc] initWithRootViewController:vc];
[self presentViewController:nvc animated:YES completion:nil];
Swift
// Load Licenses1 from a plist
let path: NSString = NSBundle.mainBundle().pathForResource("Licenses", ofType: "plist")!;
let licenses = NSArray(contentsOfFile: path);
let ddLicenses: NSArray = DDLicense.licenseArrayFromDictionaryArray(licenses);
var vc: DDLicensesViewController = DDLicensesViewController()
vc.title = "Licenses";
vc.licenses = ddLicenses;
// Optional: license list font
vc.licenseListFont = UIFont(name: "HelveticaNeue-Light", size: 17);
// Optional: license font
vc.licenseFont = UIFont(name: "Courier", size: 17);
self.navigationController?.pushViewController(vc, animated: true);
Author
Doug Diego
License
DDLicenseViewController is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "DDLicenseViewController", "version": "0.3.0", "summary": "A library to list and show licenses uses in your app.", "description": "Every responsible app developer should list out the licenses used in their app. This library makes it easy to display those licenses.", "homepage": "https://github.com/dougdiego/DDLicenseViewController", "screenshots": "https://raw.githubusercontent.com/dougdiego/DDLicenseViewController/master/Assets/DDLicenseViewControllerDemo.gif", "license": "MIT", "authors": { "dougdiego": "[email protected]" }, "source": { "git": "https://github.com/dougdiego/DDLicenseViewController.git", "tag": "0.3.0" }, "social_media_url": "https://twitter.com/dougdiego", "platforms": { "ios": "7.0" }, "requires_arc": true, "source_files": "Pod/Classes", "resource_bundles": { "DDLicenseViewController": [ "Pod/Assets/*.png" ] } }
Fri, 04 Mar 2016 07:07:03 +0000