iOS 5 Load View from UIActionSheet Button

丶灬走出姿态 提交于 2019-12-06 15:58:01

问题


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
    }
}

回答1:


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.



来源:https://stackoverflow.com/questions/8868116/ios-5-load-view-from-uiactionsheet-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!