2014-07-23 4 views
-1

Supposons que je crée toutes mes vues dans le storyboard, similar to this SO question. Pour la méthodeoù obtenir l'identifiant pour instantiateViewControllerWithIdentifier

SomeController *myController = [self.storyboard 
    instantiateViewControllerWithIdentifier:@"yourIdentifier"]; 

Où puis-je obtenir/définir "yourIdentifier" dans le storyboard? Sous Identity inspector > Identity sont deux options: Storyboard ID et Restoration ID. Mais par le document pour la méthode instantiateViewControllerWithIdentifier ne semble pas être la réponse.

+0

Il est ID Storyboard; ID de restauration est pour autre chose. – dasblinkenlight

+0

Merci. Ça marche. –

Répondre

1

Vous devez utiliser un identifiant StoryBoard.

Vous pouvez le donner en storyboard comme sur l'image montrée.

storyboard ID

Ensuite, utilisez cet identifiant comme

SomeController *myController = [self.storyboard 
    instantiateViewControllerWithIdentifier:@"ViewController"];