测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可 | Apache 2 |
发布最后发布 | 2016 年 8 月 |
由 Uros Infrared 维护。
依赖 | |
ReactiveCocoa | = 2.1.8 |
RESideMenu | ~> 4.0.7 |
IQKeyboardManager | >= 0 |
MBProgressHUD | ~> 0.9.1 |
SSKeychain | >= 0 |
Infrared 是一个用于 iOS 开发的库,它允许控制应用的 UI、交互和资源。
这是如何实现的
标签组件
{
"id" : "label_id",
"type" : "label",
"backgroundColor" : "#ff000080",
"text" : "IR Label",
"textAlignment" : "NSTextAlignmentCenter",
"textColor" : "#ffffffaa",
"font" : "SystemBold, 16"
}
IR.controller({
"data" : {
"text_1" : 'value 1',
"text_2" : 'value 2',
"color" : '#ffffff'
},
"actionMethod" : function () {
// do some UI/Interaction/Data manipulation
}
});
Infrared 账户应用的入口点是 App.json,其中列出用于定义 UI、交互和资源的文件。
{
"id": "app_name",
"screens": [
{
"deviceType": "phone",
"path": "lending_screen.json",
"controller" : "lending_screen_plugin.js"
},
{
"deviceType": "phone",
"path": "signin_and_singup_screen.json",
"controller" : "signin_and_singup_screen_plugin.js"
}
],
"jsLibraries" : [
"data_storage.js", "data_processing.js", "network_communication.js"
],
"mainScreenId": "lending_screen_id",
"i18n" : {
"default" : "en",
"languages" : {
"en" : "en.json",
"fr" : "fr.json"
}
},
"version": 2
}
最简单的方法是使用 Podfile 并在 AppDelegate 中启动库。
pod "Infrared"
如果整个应用应该作为 Infrared 应用(根视图控制器由 mainScreenId
作为 app.json 中指示自动设置)使用以下方法
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
[[Infrared sharedInstance] buildInfraredAppFromPath:@"app.json"];
return YES;
}
如果 Infrared 视图控制器只是整个 iOS 应用的一部分,则使用以下方法
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
[[Infrared sharedInstance] buildInfraredAppFromPath:@"app.json" setRootViewController:NO];
return YES;
}
详细的文档可以在项目的 维基页面 中找到
重要
Infrared iOS 库(infrared_ios)是根据 Apache 许可协议版本 2.0 发布的。请参阅 LICENSE。