使用提醒按钮更改提醒消息,而不会解除

时间:2015-11-08 20:00:05

标签: ios objective-c xcode uikit uialertview

我正在尝试使用警报按钮之一更改警报的消息并且它会发生变化,但触摸后警报会消失。 我怎么能阻止警报视图消失?它应该只用Ok-button消失。

创建提醒:

- (void)showHint
{
    NSLog(@"Show hint method");

    NSString *hintName = [[jsonArray objectAtIndex:nearestBeaconPassedNumber] objectForKey:@"hint name"];
    NSString *hintDescription = [[jsonArray objectAtIndex:nearestBeaconPassedNumber] objectForKey:@"description"];

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:hintName
                                                    message:hintDescription
                                                   delegate:self
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:@"Simpler", @"More simpler", nil];

    [alert show];
}  

使用按钮更改消息:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

    //Here I change alert's message

    switch (buttonIndex) {
        case 0:
            NSLog(@"Ok");
            [alertView setMessage: @"Ok"];
            break;

        case 1:
            NSLog(@"Simpler");
            [alertView setMessage: @"Simpler message"];
            break;

        case 2:
            NSLog(@"More simpler message");
            [alertView setMessage: @"More simpler message"];
            break;
    }
}

1 个答案:

答案 0 :(得分:1)

总而言之,触摸任何按钮后,UIAlertView都无法被解雇。