简体   繁体   中英

If I bring up a UIActionSheet, how do I make one of the options segue to a new view?

I really have no idea how to do this. I created the UIActionSheet , it comes up when I tap a button, but I want, upon a certain option being selected for the app to segue to a new view controller.

您在UIActionSheetDelegate方法中调用(当用户点击按钮时) [self performSegueWithIdentifyer:@"segue_id"];

Use Delegate method of UIActionSheet ( – actionSheet:clickedButtonAtIndex: )

#pragma mark - UIActionSheet Delegate Methods

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(buttonIndex == 0)
    {
        // code for Button 1 
    }
    if(buttonIndex == 1)
    {
       // code for Button 2
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM