gpt4 book ai didi

iphone - 如何检查 'destructive' 按钮是否被按下(UIActionSheet - iPhone)?

转载 作者:行者123 更新时间:2023-12-03 19:32:01 24 4
gpt4 key购买 nike

我正在尝试计算出需要使用的代码行,以确定是否已在 UIActionSheet 中按下“破坏性”按钮。

我环顾四周并找到了委托(delegate)方法...

 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

..而且我还设法找到了[myActionSheet virtualButtonIndex],我只是不确定如何将两者放在一起。这是我到目前为止所尝试过的但没有成功:

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == destructiveButtonIndex)
{
// Do something...
}
}

最佳答案

你的代码非常接近。您正在寻找的实现是:

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == actionSheet.destructiveButtonIndex)
{
// Do something...
}
}

关于iphone - 如何检查 'destructive' 按钮是否被按下(UIActionSheet - iPhone)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7619755/

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