gpt4 book ai didi

iphone - 当其父 View 从外部弹出时如何关闭 UIAlertView?

转载 作者:行者123 更新时间:2023-12-01 19:13:06 26 4
gpt4 key购买 nike

我在这样的函数调用中在本地显示了一个警报 View ......

        UIAlertView *alert_local = [[UIAlertView alloc]
initWithTitle:nil
message:@"Are you sure want to discard what you have recorded so far?"
delegate:self cancelButtonTitle:@"Yes"
otherButtonTitles:@"No", nil];
alert_local.tag = 4;
[alert_local show];

但我没有对此做出回答是或否。在一个序列中,我弹出了从外部显示警报的 View ,但警报 View 仍然存在,我通过将警报 View 设置为 ivar 来处理它。这是正确的方法吗?或任何其他方式来处理这种序列?为什么弹出其父 View 后警报 View 仍然存在?

最佳答案

是的,如果 View Controller 显示警报 View ,它负责删除警报。

如果 View Controller 可能因用户未触发的某些事件而消失,则它必须确保警报 View 被解除。因此将其存储在 ivar 中似乎是合适的。我为此使用了一个弱 ivar,因为当它消失时没有必要保留 View 。

关于iphone - 当其父 View 从外部弹出时如何关闭 UIAlertView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15111680/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com