Giter Club home page Giter Club logo

fflicensesviewcontroller's Introduction

FFLicensesViewController

Easily display third-party licenses in your app.

How it works

Create an instance of FFLicensesViewController as rootViewController of a UINavigationController:

FFLicensesViewController *licensesViewController = [[FFLicensesViewController alloc] init];
UINavigationController *licensesNavigationController = [[UINavigationController alloc] initWithRootViewController:licensesViewController];

Create your FFLicense instances:

NSBundle *bundle = [NSBundle mainBundle];
BOOL iOS7 = [UIDevice currentDevice].systemVersion.floatValue >= 7.0f;
FFLicense *fullscreenConstraint = [FFLicense licenseWithTitle:@"NSLayoutConstraint+FullscreenConstraints" filePath:[bundle URLForResource:@"NSLayoutConstraint+FullscreenConstraints_License" withExtension:((iOS7) ? @"rtf" : @"txt")]];
FFLicense *animatedTableUpdate = [FFLicense licenseWithTitle:@"UITableView+AnimatedArrayUpdate" filePath:[bundle URLForResource:@"UITableView+AnimatedArrayUpdate_License" withExtension:@"txt"]];

Set the licenses property of the FFLicensesViewController and present it (modally in this case):

licensesViewController.licenses = @[fullscreenConstraint, animatedTableUpdate];
[self presentViewController:licensesViewController animated:YES completion:nil];

If you already have a UINavigationController you can of course just create an instance of FFLicensesViewController, set the licenses property and push it onto the navigation stack:

FFLicensesViewController *licensesViewController = [[FFLicensesViewController alloc] init];
licensesViewController.licenses = @[fullscreenConstraint, animatedTableUpdate];
[self.navigationController pushViewController:licensesViewController animated:YES];

Also have a look at the sample project.

Some notes about the license files

As of iOS 7 you can use rtf files and it will turn them into NSAttributedString. Although the FFLicense always returns NSAttributedString they only have attributes on iOS 7+. On iOS 6 it will just load a normal string and turn it into a NSAttributedString without any attributes. As seen in the example above (as well as the sample project) you can just set different file extensions depending on which iOS version you run on. This, however, requires two versions of each license file.

License

This library is released under MIT. For more details see the LICENSE file.

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.