UIAlertViewDelegate协议(protocol)定义了两种方法alertView:clickedButtonAtIndex:alertView:didDismissWithButtonIndex:,在我看来它们的用途是相同的。

当他们都做相同的事情时,为什么会有clickedButtonAtIndexdidDismissButtonWithIndex?我意识到在关闭警报 View 之前还会发生willDismissButtonWithIndex,但是是否有任何理由使用clickedButtonAtIndex而不是didDismissButtonWithIndex

最佳答案

我发现两者之间有一个更有用的区别:

当显示UIAlertView时,设备进入休眠状态,即使实际上未关闭警报 View ,也会调用alertView:didDismissWithButtonAtIndex:。设备唤醒后再次显示。仅当用户单击其中一个按钮时才调用alertView:clickedButtonAtIndex:

关于iphone - UIAlertViewDelegate clickedButtonAtIndex : usefulness?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2494091/

10-12 15:44