UIAlertView弹出框

<Alert弹出框提示用户信息>
    1.遵循代理方法<UIAlertViewDelete>
    2.调用方法UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"恭喜通关!" message:@"更多精彩,请购买下一关~~" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"购买",@"购买1",@"购买2",nil];
        alert.tag = 10;
        [alert show];
    3.点击第几个按钮根据ButtonIndex 传值  调用代理方法(设置tag就是有多个alertView ,根据这个判断)
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {     NSLog(@"%d",alertView.tag);
           NSLog(@"%d",buttonIndex);
            if (buttonIndex == 1) { // 点击了购买按钮
                    NSLog(@"点击了购买按钮");   }
    }

posted @ 2015-11-26 22:56  木木文  阅读(364)  评论(0编辑  收藏  举报