1、弹出提示框
UIAlertView *alerView1 = [[UIAlertView alloc] initWithTitle:@"充值提醒" message:@"已成功充值10000金币!" delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil];
[alerView1 show];
2、监听提示框
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
例如:
//监听提示框单击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//操作提示,在最后一题的时候点击下一题弹出的提示框
if ([alertView.title isEqualToString:@"操作提示"]) {
//选择购买
if(buttonIndex==1 || buttonIndex==2)
{
NSString * tipStr = [NSString stringWithFormat:@"%@%@",[alertView buttonTitleAtIndex:buttonIndex],@"提示"];
NSString * messageStr = [NSString stringWithFormat:@"%@%@",[alertView buttonTitleAtIndex:buttonIndex],@"成功!已经开启下一关"];
UIAlertView *alerView1 = [[UIAlertView alloc] initWithTitle:tipStr message:messageStr delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"下一关", nil];
[alerView1 show];
}
}
//付费提示
if ([alertView.title isEqualToString:@"购买提示"]||[alertView.title isEqualToString:@"暴力破解提示"]) {
//下一关
if(buttonIndex==1)
{
self.index=0;
[self nextQues];
}
}
//通关提示
if ([alertView.title isEqualToString:@"通关提示"]) {
if(buttonIndex==1)[self nextQues];
}
//提示提醒
if ([alertView.title isEqualToString:@"提示提醒"]) {
if(buttonIndex==1 || buttonIndex==2)
{
UIAlertView *alerView1 = [[UIAlertView alloc] initWithTitle:@"充值提醒" message:@"已成功充值10000金币!" delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil];
[alerView1 show];
[self setScore:10000 andStr:@"+10000"];
}
}
|
|