Reputation: 1990
I have a UITableView with book titles. I also have a view (AddAndEditBookViewController) to enter info about the books. When I click "+" on the table's navigation bar I want to open my AddAndEditBookViewController. I know how to do it if I create the table in a separate nib file, but how do I do this if my view is created within the storyboard (without segues... more for learning purposes at this point).
I read that I coud use the instantiateViewControllerWithIdentifier method from the storyboard, but how do I find the id of my view controller? I tried looking into the XML representation of the storyboard, but I don't seem to find it...
Here's the code that tries to open the modal view.
- (void)insertNewObject:(id)sender
{
AddAndEditBooksViewController * addViewController = (AddAndEditBooksViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"gH8-2m-MXv"];
[addViewController setDelegate:self];
[addViewController setModalPresentationStyle:UIModalPresentationFormSheet];
[self presentViewController:addViewController animated:YES completion:NULL];
}
My specific question is: What identifier should I use? where is it specified or how do I manually specify it?
Thanks!
Upvotes: 17
Views: 16836
Reputation: 104082
It's under the Identity Inspector tab in IB. It's called "Storyboard ID". You can give it any unique name that you want.
Upvotes: 35