Typhoon:Assembly和Storyboard-Created ViewControllers [英] Typhoon: Assembly and Storyboard-Created ViewControllers

查看:103
本文介绍了Typhoon:Assembly和Storyboard-Created ViewControllers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Typhoon用于iOS故事板,其中视图控制器是由系统隐式生成的?我是否必须在prepareForSegue方法中做一些特别的事情?

How would I use Typhoon with iOS storyboards where view controllers are generated implicitly by the system? Would I have to do something special in the prepareForSegue methods?

推荐答案

使用TyphoonStoryboard非常简单

It is very simple with TyphoonStoryboard

通过引导你的plist中的Typhoon ,以及通常的UILaunchStoryboardName和UIMainStoryboardFile,Typhoon将确保所有Storyboard都是TyphoonStoryboard的一个实例。完全像使用普通的Storyboard一样使用,并根据TyphoonAssembly类中的定义注入依赖项。

By bootstrapping Typhoon in your plist, along with the usual UILaunchStoryboardName and UIMainStoryboardFile, Typhoon will ensure that all Storyboards are an instance of TyphoonStoryboard. Use exactly as you would a normal Storyboard, with the added benefit that dependencies will be injected according to the definitions in your TyphoonAssembly class(es).

或者,您可以指定每个viewController应使用哪个定义。为此,在storyboard中使用'typhoonKey'运行时属性。否则,将使用与控制器类匹配的定义。示例:

Optionally, you can specify which definition should be used for each viewController. For that, use 'typhoonKey' runtime attribute in storyboard. Otherwise the definition matching the controller class will be used. Example:

此功能的文档是这里

这篇关于Typhoon:Assembly和Storyboard-Created ViewControllers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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