ios - 使用警报按钮更改警报消息而不关闭

标签 ios objective-c xcode uikit uialertview

我正在尝试使用警报按钮之一更改警报消息并且它发生了变化,但警报在触摸后消失了。 如何阻止警报 View 消失?只有按“确定”按钮它才会消失。

创建提醒:

- (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;
    }
}

最佳答案

总而言之,确实不可能阻止 UIAlertView 在触摸其任何按钮后被关闭。

关于ios - 使用警报按钮更改警报消息而不关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33598382/

相关文章:

ios - Google Plus 共享有效,但在应用程序中共享时会发出警报

xcode - 出现编译错误时让 xcode 播放声音

ios - 除了推送收据之外,关闭 FireBase 调配还会影响分析吗?

ios - View 中的图像大于设备屏幕

ios - swift void SendDelegateMessage.. webView :decidePolicyForNavigationActionfailed to return after waiting 10 seconds. .. kCFRunLoopDefaultMode

objective-c - 来自 NSSet 的 NSArray 元素未显示在 TableViewCell 中

ios - Xcode 7.1 在归档 swift ios 应用程序时挂起

ios - Apple IAP 实体商品折扣

iphone - 使用 objective-c 禁用 UIWebView 默认滚动行为

objective-c - 如何对 NSMutableArray 进行排序