HoloResource 0.1.1

HoloResource 0.1.1

gonghonglou 维护。



  • gonghonglou

HoloResource

CI Status Version License Platform

示例

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

要求

1、shell 脚本

需要在 pod install 之后调用脚本配置预编译宏:HOLO_POD_NAME,例如在 Pofile 里:

post_install do |installer|
  system "sh Pods/HoloResource/HoloResource/Assets/holo_pod_name_config.sh"
end

该脚本默认给所有 Pod 添加配置,如果想指定 Pod 添加配置的话给脚本传入参数,例如在 Pofile 里:

post_install do |installer|
  system "sh Pods/HoloResource/HoloResource/Assets/holo_pod_name_config.sh PodA PodB PodC"
end

2、cocoapods-resource 插件(推荐)

或者你可以使用我编写的一个 CocoaPods 插件:cocoapods-resource

# 安装
gem install cocoapods-resource

# 调用
pod resource HOLO_POD_NAME
or
pod resource HOLO_POD_NAME --pods='PodA, PodB, PodC'

用法

UIImage

UIImage *image = HoloImageNamed(@"icon");
// or
UIImage *image = [UIImage holo_imageNamed:@"icon" inBundle:HOLO_POD_NAME];

NSBundle

NSBundle *bundle = HoloCurrentBundle;
// or
NSBundle *bundle = [NSBundle holo_bundleNamed:HOLO_POD_NAME];

UIFont

// 注册字体
HoloRegisterFont(@"GOTHIC", @"TTF");
// or
[UIFont holo_registerFont:@"GOTHIC" withExtension:@"TTF" bundleName:HOLO_POD_NAME];

本地化

NSString *string = HoloLocalizedStringFromTable(@"key", @"table", nil);
// or
NSString *string = HoloLocalizedStringWithDefaultValue(@"key", @"table", @"value", nil);

安装

HoloResource可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中

pod 'HoloResource'

作者

gonghonglou, [email protected]

许可协议

HoloResource 遵循 MIT 许可协议。更多信息请参阅 LICENSE 文件。