2012-03-15 57 views
7

我具有基于UISplitViewController其示出了在拆分的MasterViewController一个ActionSheet的应用程序。在iOS 5.1之前,我并没有在分离出现的弹出窗口中显示操作表,但现在,显示MasterController的新“滑入式”方式显然存在问题。的iOS 5.1 + UISplitViewController在PortraitMode + UIActionSheet在MasterController =断言故障

事情是,当我试图使用任何[actionSheet show ..]方法呈现ActionSheet时,应用程序崩溃,出现以下错误(确切声明如下)。

*** Assertion failure in -[UIActionSheet presentSheetInPopoverView:], /SourceCache/UIKit_Sim/UIKit-1914.84/UIActionSheet.m:1816 
sharedlibrary apply-load-rules all 
Error in re-setting breakpoint 1: 
Catchpoint 2 (throw)Error in re-setting breakpoint 1: 
Error in re-setting breakpoint 1: 
Current language: auto; currently objective-c 

我谷歌这一段时间,但没有实质性的答案。有人说,它可以在 新SplitViewController一个bug ......

想法?

预先感谢您!

更新:我贴出了可能的解决办法一般,检查出来。如果你的作品,发表评论....如果其确定,我将迎来它在几天

+0

那么有什么实际的说法对吗?从控制台给我们留言。 – 2012-03-15 20:48:52

+0

我用精确的断言编辑了问题。谢谢 – Omer 2012-03-16 12:22:36

+0

之后我们需要控制台中的下十行左右。 – 2012-03-16 13:04:26

回答

2

我有同样的问题也为正确。防止崩溃

一个解决办法,至少是要表明你的UIActionSheet这样的:

if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { 
    [self.actionSheet showFromBarButtonItem:sender animated:YES]; 
} else { 
    [self.actionSheet showInView:self.view.window]; 
} 

因此,在人像模式中,动作片显示在窗口的中心。不理想,但至少它不会崩溃。而在横向模式下,它表现正常。

+0

检查我的答案并发表评论 – Omer 2012-04-25 14:36:12

0

另一种选择是保持指定特定选项的弹出效果,实际上可以执行以下操作: 1.创建您自己的UIPopover 2.在UIPopover内部创建您自己的UIViewController。 3.在新创建的UIViewController中显示UIActionSheet。 4. UIActionSheet大小中的SetPopoverContentSize。 5.最后,连线你的UIActionsheet的点击方法来关闭弹出窗口。

需要一些更多的代码,但给你,你在大多数情况下收到了相同的功能,并具有对UIActionsheet一个很酷的小滑入效果。

+0

检查我的答案并评论您的意见 – Omer 2012-04-25 14:37:09

0

我认为下面是一个基于标签形式的回答一个通用的解决方案:

CGRect windowsRect = [actionSheetContainerView convertRect:viewToPresentActionSheet.frame toView:actionSheetContainer.window]; 
[actionSheet showFromRect:windowsRect inView:actionSheetContainer.window animated:YES]; 

这将怨恨actionSheet窗口,但指向正确的方向

1

正如OMZ评论,似乎这个问题已被苹果在iOS 5.1.1中解决。 因此,我决定将其添加到我的应用的更改日志的已知问题部分,解决方法是建议用户升级到iOS 5.1.1。基于上述

4

,并进行大规模的关于苹果电脑的工程师谁在WWDC帮我,这里不仅解决了这个错误,但也指出,在右键的酥料饼的解决方案。

if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) 
    { 
     [actionSheet showFromBarButtonItem:self.actionSheetBarButtonItem animated:YES]; 
    } 
    else 
    { 
     CGRect windowsRect = [self.navigationController.toolbar convertRect:self.actionSheetBarButtonItem.customView.frame toView:self.view.window]; 

     [actionSheet showFromRect:windowsRect inView:self.view.window animated:YES]; 
    } 
+0

如果它不是自定义按钮,则必须从navigationController.view尺寸计算出rect的位置,因为没有customView。 – Conor 2014-03-11 04:24:18

相关问题