Several UIAlertViews for a delegate

前端 未结 5 843
-上瘾入骨i
-上瘾入骨i 2020-12-13 13:21

Currently I\'ve got a class popping up UIAlertViews here and there. Currently, the same class is the delegate for these (it\'s very logical that it would be). U

5条回答
  •  生来不讨喜
    2020-12-13 13:38

    easier & newer

    UIAlertView *alert = [[UIAlertView alloc] init...
    alert.tag = 1;
    
    UIAlertView *alert = [[UIAlertView alloc] init...
    alert.tag = 2;
    
    
    
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
        if(alertView.tag == 1) {
            // first alert...
        } else  {
            // sec alert...
        }
    }
    

    all done!

提交回复
热议问题