Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

instantiateViewControllerWithIdentifier, but where is the identifier in xCode 4.5?

Tags:

ios

xcode4.5

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!

like image 656
fiacobelli Avatar asked Oct 09 '12 05:10

fiacobelli


1 Answers

It's under the Identity Inspector tab in IB. It's called "Storyboard ID". You can give it any unique name that you want.

like image 107
rdelmar Avatar answered Oct 31 '22 12:10

rdelmar