iOS:UIActionsheet(或UIPopoverController视图)变成僵尸

时间:2011-12-08 19:19:21

标签: ios uiactionsheet zombie-process

我有一个UIViewController。在其中,用户可以启动UIActionsheet或popover。如果设备旋转,则有意释放UIViewController。问题是UIActionsheet / popover继续存在并成为一个僵尸,以后会困扰我。用户可以单击僵尸中的按钮并使应用程序崩溃。我试图在dealloc或shouldAutorotateToInterfaceOrientation中调用[actionsheet dismissWithClickedButtonIndex:0 animated:NO]。没有效果。感谢任何建议。感谢。

1 个答案:

答案 0 :(得分:0)

我从这篇文章中找到了解决方案:[dismiss actionsheet] [1]

[1]:iPad crash with UIActionSheet displayed from child view controller。我试图通过搜索UIViewController视图的子视图或调用viewWithTag方法来回忆动作表,这是错误的。奇怪的是,它确实返回了一个非零的对象。但是使用此对象调用dismissWithClickedButtonIndex不起作用。

帖子的autor建议使用UIActionSheet指针并关闭viewWillDisapper中的动作表。对于上面的特定应用程序,我发现在dealloc中删除动作表会更好。