当用户触摸 UIAlertView 中的按钮时,我试图显示 UIActionSheet:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
UIActionSheet *actionSheet = ...
[actionSheet showFromTabBar:self.tabBarController.tabBar];
}
}
当显示操作表时,警报视图仍在操作表后面的屏幕上,当我触摸操作表中的按钮时 - 操作工作表消失,但整个屏幕变暗,警报视图仍然打开,我无法关闭它。
我尝试了几件事,例如在短暂延迟后显示操作表或以编程方式关闭警报视图,但没有任何效果。在最好的情况下(以编程方式关闭警报视图),警报视图在经过有点奇怪的转换后确实消失了,但当它消失时,我在日志中收到了“等待栅栏无法接收回复”错误。
如何从警报视图中有序地显示操作表?
I'm trying to show a UIActionSheet when the user touches a button in a UIAlertView:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
UIActionSheet *actionSheet = ...
[actionSheet showFromTabBar:self.tabBarController.tabBar];
}
}
When the action sheet is shown the alert view is still on the screen behind the action sheet, and when I touch a button in the action sheet - the action sheet disappears but the whole screen is dimmed with the alert view still on and I can't dismiss it.
I tried several things, such as showing the action sheet after a short delay or dismissing the alert view programmatically, but nothing worked. In the best case (dismissing the alert view programmatically) the alert view did disappear after a somewhat-strange transition but I got a "wait-fence failed to receive reply" error in the log when it did.
How can I show an action sheet from an alert view in an orderly manner?
发布评论
评论(2)
在这种情况下,您应该使用
方法而不是
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
这样您的代码将是:
谢谢,
In this case, you should use
method rather than,
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
so your code wil be:
Thanks,
只需调用 dismissWithClickedButtonIndex:animated: 方法
Just call dismissWithClickedButtonIndex:animated: method for UIAlertView