UIAlertView

- (IBAction)backAction:(UIBarButtonItem *)sender {
 
        UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"提示" message:@"你确定放弃添加吗" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertview show];

}
#pragma mark alertview

//UIAlertView协议中的方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    switch (buttonIndex) {
        case 0:
            break;
        case 1:
            [self dismissViewControllerAnimated:YES completion:nil];
            break;
        default:
            break;
    }
}

你可能感兴趣的:(弹出对话框,uialertview)