使用多个情节提要板进行状态恢复 [英] State Restoration with Multiple Storyboards

查看:88
本文介绍了使用多个情节提要板进行状态恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个有多个故事板的项目中.我想在该项目中实现状态恢复.我在将第二个故事板上的ViewController链接到状态恢复过程时遇到问题.

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:方法仅对与Main故事板关联的ViewController调用.

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

如何将第二个情节提要中的ViewController链接到状态恢复过程?

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

推荐答案

从其他情节提要中加载类时,基本上需要开始使用手动方法进行状态还原. (又名还原类)

When you load a class from the other storyboard you essentially need to start using the manual approach to state restoration. (aka Restoration Classes)

这意味着您在第二个情节提要板上加载的视图控制器必须分配一个还原ID,并实现UIViewControllerRestoration协议.

This means that the view controller you loaded on the second storyboard must have a restoration ID assigned and implement the UIViewControllerRestoration protocol.

这篇关于使用多个情节提要板进行状态恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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