Two Alert Views in One View Controller - buttonIndex Response

前端 未结 4 1143
日久生厌
日久生厌 2021-01-13 06:01

I am trying to perform the smile task of having two alerts in a single View Controller. The code below works fine, but how would I make another instance of it elsewhere in t

4条回答
  •  醉梦人生
    2021-01-13 06:25

    set tag to alert view.

    alert.tag = 1;
    
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        if (buttonIndex == 1 && alertView.tag == 1) 
        {
        //do something
        }
    }
    

提交回复
热议问题