Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Restoration ID and identifier to a UITableViewCell that set in storyboard

When I drag a UITableViewCell to a tableView in storyboard, I find there are two ID to be set in the inspector. One is in the Identity Inspector(Restoration ID) and the other is in Attributes Inspector(identity).

What's the difference between them?

like image 419
wkx Avatar asked May 09 '16 04:05

wkx


People also ask

What is restoration identifier?

The identifier that determines whether the view controller supports state restoration.

What are storyboard identifiers for?

A storyboard ID does exactly what the name implies: it identifies. Just that it identifies a view controller in a storyboard file. It is how the storyboard knows which view controller is which.

How do you set the identifier on a storyboard?

Step 1: Set a Storyboard IDIn the Storyboard, select the view controller that you want to instantiate in code. Make sure the yellow circle is highlighted, and click on the Identity Inspector. Set the custom class as well as the field called "Storyboard ID". You can use the class name as the Storyboard ID.


2 Answers

Restoration IDs are used for state restoration, i.e. making your view look like it did when you quit the app-often used for re-creating objects. Storyboard IDs, on the other hand, simply identify objects on the storyboard-these are often used for creating objects.

like image 82
saagarjha Avatar answered Oct 12 '22 01:10

saagarjha


A restoration identifier is a string that you need to assign to any view controller or view that you want preserved and restored. During state preservation any view controllers or views in the view hierarchy that have a restoration identifier will be saved to disk.

The Identity in the Identity Inspector, are used to instantiate objects from Storyboard

like image 32
gunjot singh Avatar answered Oct 12 '22 01:10

gunjot singh