alterview使用

来源:互联网 发布:标识设计软件 编辑:程序博客网 时间:2024/05/20 05:03

1:设置代理

2:实现方法

  NSString *grade = self.scoreBtn.titleLabel.text;                                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"您的成绩" message:grade delegate:self cancelButtonTitle:@"不玩了" otherButtonTitles:@"新游戏", nil];                                [self.view addSubview:alertView];                                alertView.delegate  = self;                                [alertView show];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{    //不玩了,是0        //NSLog(@"buttonIndex is : %i",buttonIndex);        switch (buttonIndex) {        case 0:{                        [MBProgressHUD showMessage:@"我在后台等你==||"];                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{                 exit(0);                // 移除HUD                [MBProgressHUD hideHUD];                                // 提醒有没有新数据                //[MBProgressHUD showError:@"没有新数据"];            });                     //  [[UIApplication sharedApplication] performSelector:@selector(terminateWithSuccess)];        }break;        case 1:{                        [self startNewGame];                    }break;              default:            break;    }}



0 0
原创粉丝点击