Saving and Restoring Your View Controllers

Saving and Restoring Your View Controllers

这两种过程都是自动的,但是你必须明确需要保留的部分

For an overview of the preservation and restoration process, see App Programming Guide for iOS.

* (Required) Assign restoration identifiers to the view controllers whose configuration you want to preserve; see Tagging View Controllers for Preservation.

* (Required) Tell iOS how to create or locate new view controller objects at launch time; see Restoring View Controllers at Launch Time.

* (Optional) For each view controller, store any specific configuration data needed to return that view controller to its original configuration; see Encoding and Decoding Your View Controller’s State.

Tagging View Controllers for Preservation

Each view controller has a restorationIdentifier property----->

1--Choosing Effective Restoration Identifiers

2--Excluding Groups of View Controllers

3--Preserving a View Controller’s Views

Restoring View Controllers at Launch Time

Encoding and Decoding Your View Controller’s State

Tips for Saving and Restoring Your View Controllers

在交换的过程中,不要去保存与恢复vc——does not restore the full state of the object.

保存vc时,对vc进行编码;恢复vc时,对vc进行解码

你可能感兴趣的:(Saving and Restoring Your View Controllers)