Brian
Brian

Reputation: 733

iOS 5 Load View from UIActionSheet Button

Got an iOS 5 storyboard question. First app I'm building with Storyboards and i like using them, but i can not for the life of me figure out how to load a view from a UIActionSheet button. I have the UIActionSheet running just fine and it loads a UIAddressBook picker, but I want to have it switch to a new storyboard view controller.

Any ideas?

Here's some of the code:

// Specify what to do when a user selects a button from the personSelectQuery
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        [self showAddressPicker];//This works just fine to show the address book

    } else if (buttonIndex == 1){
        [self showAddPersonView];//This is the custom storyboard view i want to load
    }
}

Upvotes: 0

Views: 2329

Answers (1)

barley
barley

Reputation: 4473

Look at the [UIStoryboard instantiateViewControllerWithIdentifier:] method. You can set an identifier for specific ViewController in attribute inspector of IB. You call above method using this identifier as a parameter and iOS instantiates the ViewController from storyboard. The rest is the same as other ViewControllers without Storyboard.

Upvotes: 3

Related Questions