State Restoration with Multiple Storyboards

孤街醉人 提交于 2019-12-23 09:21:48

问题


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.

encodeRestorableStateWithCoder: & decodeRestorableStateWithCoder: methods are invoked only for ViewControllers associated with the Main storyboard.

How do you link the ViewControllers in the second storyboard to the state restoration process?


回答1:


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.



来源:https://stackoverflow.com/questions/26077127/state-restoration-with-multiple-storyboards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!