Show Alert in clickedButtonAtIndex?

后端 未结 1 722
情歌与酒
情歌与酒 2021-01-16 02:23


i need to show a confirm alert after the user press buttonIndex 1 but... if i use popViewcontroller in clickedButtonAtIndex it cr

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-16 03:02

    Set the tag properties of the two UIAlertViews to 1 and 2, respectively. Then, in the delegate method, use if statements to check the tag of the UIAlertView argument.

    Example:

    - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        if (alertView.tag == 1)
        {
            //check the button index
            //create and display the other alert view (set the tag property here to 2)
        }
        else if (alertView.tag == 2)
        {
            //pop the view controller
        }
    }
    

    0 讨论(0)
提交回复
热议问题