RFAboutView 1.0.4

RFAboutView 1.0.4

测试测试
语言语言 Obj-CObjective C
许可 MIT
发布最后发布2015年8月

René Fouquet 维护。




RFAboutView 是一个简单易用的解决方案,可以在应用程序中显示版权、支持、隐私信息,并自动为第三方 Cocoapods 的发展者提供信誉。RFAboutView 使用 AutoLayout 并适用于 iPhone 和 iPad 应用程序。

注意:这是 RFAboutView 的 Objective-C 版本。还有一个用 Swift 编写的版本,可在 这里找到。除了一些小的实现差异外,两个版本都具有相同的特性集,并且行为方式相同。

其主要特点是

  • 显示应用程序名称和版权信息。
  • 显示一个可选的网站链接,在 Safari 中打开。
  • 显示一个可选的电子邮件地址链接。
  • 如果用户单击电子邮件链接,则会打开一个 MFMailComposeViewController,(可选)预先填入有用的诊断信息,以支持:应用程序名称和版本、当前设备、当前 iOS 版本、首选设备语言。
  • 显示其他带有更多信息(例如您的服务条款或隐私政策)的按钮,您可以指定这些按钮。
  • 显示项目中使用的所有 Cocoapods 的致谢信息。此致谢文件由 Cocoapods 自动创建,无需您做太多工作。有关更多信息,请参阅下文“自动致谢”。
  • 干净、现代的设计,具有许多自定义选项。

屏幕截图

Screenshot 1 Screenshot 2

用法

要使用 RFAboutView,导入头文件

#import "RFAboutViewController.h"`

之后,初始化一个 RFAboutViewController 并将其添加到 UINavigationController 中。必须始终在导航堆栈中使用 RFAboutViewController。以下是一个完整的示例

// First create a UINavigationController (or use your existing one).
// The RFAboutView needs to be wrapped in a UINavigationController.

UINavigationController *aboutNavigation = [UINavigationController new];

// Initialise the RFAboutView:

RFAboutViewController *aboutView = [[RFAboutViewController alloc] initWithAppName:nil appVersion:nil appBuild:nil copyrightHolderName:@"ExampleApp, Inc." contactEmail:@"[email protected]" titleForEmail:@"Contact us" websiteURL:[NSURL URLWithString:@"http://example.com"] titleForWebsiteURL:@"Our Website" andPublicationYear:nil];

// Set some additional options:
aboutView.headerBackgroundColor = [UIColor blackColor];
aboutView.headerTextColor = [UIColor whiteColor];
aboutView.blurStyle = UIBlurEffectStyleDark;
aboutView.headerBackgroundImage = [UIImage imageNamed:@"about_header_bg.jpg"];

// Add an additional button:
[aboutView addAdditionalButtonWithTitle:@"Privacy Policy" andContent:@"Here's the privacy policy"];

// Add the aboutView to the NavigationController:
[aboutNavigation setViewControllers:@[aboutView]];

// Present the navigation controller:
[self presentViewController:aboutNavigation animated:YES completion:nil];

自动致谢

每次您运行 pod updatepod install 时,Cocoapods 都会自动生成一个文件,包含项目中使用的所有 Cocoapods 的版权和许可信息。RFAboutView 使用此文件来显示致谢。要使用它,请将位于 <Project Root>/Pods/Target Support Files/Pods-<Target Name> 目录中的文件 Pods-<Target Name>-acknowledgements.plist 复制到您的项目中,并将其命名为 Acknowledgements.plist。您还可以使用不同的名称,如果这样,请将 RFAboutViewControlleracknowledgementsFilename 属性设置为新的名称(不带 plist 扩展名)。

为了自动化此过程,您可以在 Podfile 中添加以下片段

post_install do |installer|
  require 'fileutils'
  FileUtils.cp_r('Pods/Target Support Files/Pods-<Target Name>/Pods-<Target Name>-acknowledgements.plist', '<Project Dir>/Acknowledgements.plist', :remove_destination => true)
end

请注意,目录名称会根据您的项目配置和使用不同的目标而有所不同。请根据您的本地项目目录进行修改,并相应地更改代码片段。此外,请不要忘记将 Acknowledgements.plist 文件添加到您的 Xcode 项目中。

本地化和修改默认文本

如果您想为您的应用程序本地化 RFAboutView 或要更改默认文本,可以使用示例应用程序中的 RFAboutView.strings 文件作为模板。

自定义选项

RFAboutView 包含许多自定义选项。查看 RFAboutViewController.h 文件以获取完整文档。

示例项目

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

需求

RFAboutView 需要 iOS 8.0。

安装

RFAboutView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod "RFAboutView", '~> 1.0.4'

作者

René Fouquet, [email protected]

查看我的博客: fouquet.me

在 Twitter 上关注我 @renefouquet

许可

RFAboutView 在 MIT 许可下提供。查看 LICENSE 文件以获取更多信息。