DDLicenseViewController 0.3.0

DDLicenseViewController 0.3.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布日期最新发布2015年9月

Doug Diego维护。




DDLicenseViewControllerDemo.gif

用法

要运行示例项目,请克隆仓库,然后首先从示例目录中运行pod install

要求

安装

用法

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);

作者

Doug Diego

许可

DDLicenseViewController受MIT许可协议保护。有关更多信息,请参阅LICENSE文件。