gpt4 book ai didi

ios - Splitview 中的 UIActionsheet 因 iOS 5.1 更新而崩溃

转载 作者:可可西里 更新时间:2023-11-01 05:42:20 25 4
gpt4 key购买 nike

从 iOS 5.0 更新到 iOS 5.1 后,splitview Controller 弹出窗口中的按钮显示的操作表使应用程序崩溃。它输出的错误是:* Assertion failure in -[UIActionSheet presentSheetInPopoverView:],/SourceCache/UIKit/UIKit-1914.84/UIActionSheet.m:1816所以在 Splitview Controller 的主视图中,我有一个相机按钮,我试图通过要求从相机胶卷或相机中选择来呈现一个 Action 表。有什么想法吗?

if(lpm != null)  //Long Press Menu / Action Sheet
lpm = null;
lpm = new UIActionSheet("Select an action to perform on " + Application.MO.CurrentList[indexPath.Row].Name);
foreach(var button in buttonList)
lpm.AddButton(button);
lpm.CancelButtonIndex = buttonList.Count - 1;
lpm.Style = UIActionSheetStyle.BlackTranslucent;
lpm.ShowFrom(theList.RectForRowAtIndexPath(indexPath), this.View, true);
lpm.Clicked += delegate(object sender, UIButtonEventArgs e2) {
lpm.DismissWithClickedButtonIndex(e2.ButtonIndex, false);
Application.MO.RespondToLongPressSelection(e2.ButtonIndex);
};

最佳答案

我遇到了同样的问题,并通过在主窗口中显示来修复它。尝试从触摸按钮附近的任何其他 View 或矩形显示它会导致同样的崩溃。以下是仅在纵向模式下显示在屏幕中间的代码:

    if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation))
[sortSheet showInView:self.view.window];
else
[sortSheet showFromBarButtonItem:sender animated:YES]; // rightBarButton

已经有几个radar bugs报道。但请提交一份新文件,以便他们知道每个人都在发生这种情况。

如果您不在 View Controller 中,请使用:[UIApplication sharedApplication].keyWindow 来获取显示 View 的主窗口。

关于ios - Splitview 中的 UIActionsheet 因 iOS 5.1 更新而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9711722/

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