简体   繁体   English

使用多个情节提要板进行状态恢复

[英]State Restoration with Multiple Storyboards

I am working on a project with multiple storyboards. 我正在一个有多个故事板的项目中。 I want to implement state restoration in this project. 我想在该项目中实现状态恢复。 I am having a problem linking the ViewControllers on second storyboard into the state restoration process. 我在将第二个故事板上的ViewController链接到状态恢复过程时遇到问题。

encodeRestorableStateWithCoder: & decodeRestorableStateWithCoder: methods are invoked only for ViewControllers associated with the Main storyboard. encodeRestorableStateWithCoder:与Main故事板关联的ViewController调用encodeRestorableStateWithCoder:decodeRestorableStateWithCoder:方法。

How do you link the ViewControllers in the second storyboard to the state restoration process? 您如何将第二个情节提要中的ViewControllers链接到状态恢复过程?

When you load a class from the other storyboard you essentially need to start using the manual approach to state restoration. 从其他情节提要板上加载类时,您实际上需要开始使用手动方法进行状态还原。 (aka Restoration Classes) (又名修复课程)

This means that the view controller you loaded on the second storyboard must have a restoration ID assigned and implement the UIViewControllerRestoration protocol. 这意味着您在第二个情节提要板上加载的视图控制器必须分配一个还原ID,并实现UIViewControllerRestoration协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM