John Stewart
John Stewart

Reputation: 1176

How to configure embedded view controllers using iOS6 style embed seque

I am trying to use the embed segue in a storyboard to embed a couple of CollectionViewControllers in a main view.

However, when trying to set up the embedded views using prepareForSegue (as I am familiar with doing for modal type seques), prepareForSeque is called, but the segue.identifier always returns NULL.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
   NSLog(@"segue.identifier is %@", segue.identifier);
}

segue.identifier is (null)

I've been searching for information on using the embed segue in storyboards, but have been unable to find much.

Is prepareForSegue not the correct way to access the embedded view controllers? If not, how do I set up the embedded controllers (such as to set up initial state and set a delegate)?

Upvotes: 1

Views: 447

Answers (1)

rdelmar
rdelmar

Reputation: 104082

If you've correctly set the identifier for the segue, then segue.identifier shouldn't be null. Using prepareForSegue:sender: is one of the ways to access the embedded controllers. The other way is to use self.childViewControllers from the controller whose view has the container views in it -- this will give you an array of all the child view controllers.

Upvotes: 1

Related Questions