Skip to content

86/TRZSlideLicenseViewController

Repository files navigation

TRZSlideLicenseViewController

TRZSlideLicenseViewController is a iOS horizontal scroll view controller for displaying the licenses managed by CocoaPods.

TRZSlideLicenseViewController.gif

Requirements

Installation

Add the following line to your Podfile.

pod 'TRZSlideLicenseViewController'

Usage

Add a Pods-acknowledgements.plist to your project

  1. Add a Pods-acknowledgements.plist from your Pods directory to your project.

Loadig a view from a Storyboard

  1. Add a new view controller to your storyboard.
  2. Input TRZSlideLicenseViewController to custom class field in the identity inspector of the view controller.
  3. Make a push segue connection from a source view controller in the navigation controller’s stack to the TRZSlideLicenseViewController.
  4. Input a segue identifier in the attributes inspector of the segue settings.
  5. Implemente the prepareForSegue in the source view controller class file.
#import "TRZSlideLicenseViewController.h"

...

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"segueIdentifier"]) {
        TRZSlideLicenseViewController *controller = segue.destinationViewController;
        controller.podsPlistName = @"Pods-acknowledgements.plist";
        controller.navigationItem.title = @"Sample Licenses";
    }
}

Creating a View Programmatically

  1. Implement to a source view controller in the navigation controller’s stack as follows.
#import "TRZSlideLicenseViewController.h"

...

TRZSlideLicenseViewController *controller = [[TRZSlideLicenseViewController alloc] init];
controller.podsPlistName = @"Pods-acknowledgements.plist";
controller.navigationItem.title = @"Sample Licenses";
[self.navigationController pushViewController:controller animated:YES];

Options

Cutomize the style of the header and footer page

Set the following value to headerType or footerType property of the TRZSlideLicenseViewController.

TRZSlideLicenseViewHeaderType

Value Description
TRZSlideLicenseViewHeaderTypeDefault Default. Do-nothing. Displays CocoaPods generated title and text: "Acknowledgements", "This application makes use of the following third party libraries:".
TRZSlideLicenseViewHeaderTypeNone Remove the header page.
TRZSlideLicenseViewHeaderTypeCustom Displays a custom text. Set a text to headerTitle, headerText of the controller property.

TRZSlideLicenseViewFooterType

Value Description
TRZSlideLicenseViewFooterTypeDefault Default. Do-nothing. Displays CocoaPods generated text: "Generated by CocoaPods - http://cocoapods.org".
TRZSlideLicenseViewFooterTypeNone Remove the footer page.
TRZSlideLicenseViewFooterTypeCustom Displays a custom text. Set a text to footerTitle, footerText of the controller property.

Customize the title and text color

Set a UIColor to the titleColor or textColor property of the TRZSlideLicenseViewController.

Example

...

TRZSlideLicenseViewController *controller = [[TRZSlideLicenseViewController alloc] init];
controller.podsPlistName = @"Pods-TESTTRZSlideView-acknowledgements.plist";
controller.navigationItem.title = @"Sample Licenses";

// Customize the header title and text.
controller.headerType = TRZSlideLicenseViewHeaderTypeCustom;
controller.headerTitle = @"Libraries We Use";
controller.headerText = @"This application makes use of the third party libraries on the following page (➟).\n\nWe thank the open source community for all of their contributions.";

// Remove the footer page.
controller.footerType = TRZSlideLicenseViewFooterTypeNone;

// Customize the colors
controller.view.backgroundColor = [UIColor darkGrayColor];
controller.view.tintColor = [UIColor colorWithRed:0.9 green:0.4 blue:0.4 alpha:1.0];
controller.titleColor = [UIColor whiteColor];
controller.textColor = [UIColor lightGrayColor];

[self.navigationController pushViewController:controller animated:YES];

License

MIT License

About

iOS horizontal scroll view controller for displaying the licenses

Resources

License

Stars

Watchers

Forks

Packages

No packages published