ios UIAlertView展示

-(void)showalert{
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"温馨提示"
                          message:[NSString stringWithFormat:@"\n%@", @"是否确定购买?"]
                          delegate:self
                          cancelButtonTitle:@"取消"
                          otherButtonTitles:@"投资", nil];
    alert.tag = 1024;
    [alert show];
}

 

代理:UIAlertViewDelegate

#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    
    if (1024 == alertView.tag) {
        if (buttonIndex == 0) {
            return;
        }
        [self invstBtnAction:nil];
    }
}

 

posted @ 2017-11-29 17:22  预估计  阅读(142)  评论(0编辑  收藏  举报