dismissing a UIAlertView programmatically

后端 未结 5 1572
孤城傲影
孤城傲影 2021-02-13 17:12

I need help on dismissing a UIAlertView programmatically. Currently I have this

UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@\"title\" message:@

5条回答
  •  臣服心动
    2021-02-13 17:14

    I encountered this problem too. In my case, for some reason calling:

    [alert dismissWithClickedButtonIndex:0 animated:NO];
    

    didn't work always (yes, even calling it on UI thread and yes, alert != nil), instead simply setting the animated flag to YES it worked:

    [alert dismissWithClickedButtonIndex:0 animated:YES];
    

    Maybe it's an Apple bug...

提交回复
热议问题