台风情节提要集成 [英] Typhoon Storyboard Integration

查看:85
本文介绍了台风情节提要集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中使用了StoryBoard.当我第一次开始集成台风时,我在plist中列出了程序集,如下所示:

I am using a StoryBoard in my application. When I first started integrating Typhoon, I listed the Assemblies in the plist like so:

<key>TyphoonInitialAssemblies</key>
<array>
    <string>ApplicationAssembly</string>
    <string>CoreComponents</string>
</array>

当我注入AppDelegate时,此方法运行良好.

This worked fine as I was injecting into the AppDelegate.

现在,如果我需要注入各种视图控制器,看来我必须从应用程序plist文件中删除UILaunchStoryboardNameUIMainStoryboardFile,并使用TyphoonStoryboard,如下所示:

Now, if I need to inject into the various view controllers, it appears I have to remove the UILaunchStoryboardName and UIMainStoryboardFile from the application plist file, and use a TyphoonStoryboard like so:

- (BOOL)application:(UIApplication *)application 
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    NSString *storyboardName = ...
    TyphoonComponentFactory *factory = ...

    TyphoonStoryboard *storyboard = [TyphoonStoryboard 
        storyboardWithName:storyboardName factory:factory bundle:nil];

    self.window = ...
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    [self.window makeKeyAndVisible];

    return YES;
}

但是,我对获得TyphoonComponentFactory的位置感到困惑.既然我已经在plist中列出了程序集,我可以以某种方式使用它吗?

However, I'm confused where I obtain the TyphoonComponentFactory. Since I already list the assemblies in the plist, can I somehow use that?

推荐答案

看来我必须从应用程序plist文件中删除UILaunchStoryboardName和UIMainStoryboardFile,并像这样使用TyphoonStoryboard

it appears I have to remove the UILaunchStoryboardName and UIMainStoryboardFile from the application plist file, and use a TyphoonStoryboard like so

不正确.您可以在info.plist文件中结合使用UIMainStoryboardFile(UILaunchStoryboardName)和TyphoonInitialAssemblies键.

Incorrect. You can combine UIMainStoryboardFile (UILaunchStoryboardName) and TyphoonInitialAssemblies keys in your info.plist file.

在这种情况下,创建的情节提要将是TyphoonStoryboard,并具有台风工厂(使用plist程序集中的指定创建).

In that case, created storyboard will be TyphoonStoryboard and has typhoon factory (created with specified in plist assemblies).

根据一个或多个TyphoonAssembly类中的定义,可以完全像平常一样使用情节提要,还有一个好处是还可以注入依赖项.

You can use storyboards exactly as you'd normally use them, with the added benefit that dependencies will also be injected, according to the definitions in your one ore more TyphoonAssembly classes.

这篇关于台风情节提要集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆