gpt4 book ai didi

iphone - 来自 UIAlertView 的 UIActionSheet

转载 作者:可可西里 更新时间:2023-11-01 06:18:35 25 4
gpt4 key购买 nike

我试图在用户触摸 UIAlertView 中的按钮时显示 UIActionSheet:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{
if (buttonIndex == 0)
{
UIActionSheet *actionSheet = ...
[actionSheet showFromTabBar:self.tabBarController.tabBar];
}
}

当显示操作表时,警报 View 仍在操作表后面的屏幕上,当我触摸操作表中的按钮时 - 操作表消失但整个屏幕变暗,警报 View 仍然打开并且我不能拒绝它。

我尝试了几种方法,例如在短暂延迟后显示操作表或以编程方式关闭警报 View ,但没有任何效果。在最好的情况下(以编程方式关闭警报 View )警报 View 确实在有点奇怪的转换后消失了,但是当它消失时我在日志中收到了“wait-fence failed to receive reply”错误。

如何有序地显示警报 View 中的操作表?

最佳答案

在这种情况下,你应该使用

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex

方法而不是,

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

所以你的代码将是:

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
UIActionSheet *actionSheet = ...
[actionSheet showFromTabBar:self.tabBarController.tabBar];
}
}

谢谢,

关于iphone - 来自 UIAlertView 的 UIActionSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8307700/

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