【问题标题】:UIActionSheet doesn't appearUIActionSheet 没有出现
【发布时间】:2013-09-23 22:56:27
【问题描述】:

我正在尝试在 UIViewController 中创建 UIActionSheet,如下所示:

discardAS = [[UIActionSheet alloc] initWithTitle:"title" delegate:self cancelButtonTitle:"Cancel" destructiveButtonTitle:"Discard" otherButtonTitles:nil];

discardAS.actionSheetStyle = UIActionSheetStyleDefault;
[discardAS showInView:[self view]];

当我唤起它时——整个屏幕“变暗”(好像操作表实际上在前台)——但我看不到操作表。)它似乎显示“离屏”。

当我在 iOS7 上尝试此操作时,我可以看到一个白色的框向上射击,迅速离开屏幕 - 好像 ActionSheet 被放置在屏幕顶部上方。当我点击窗口时,昏暗消失,一切正常 - 就像 iOS7 一样,如果您点击操作表然后它就会消失。

因此,我得出的结论是,ActionSheet 是在屏幕范围内(和外)呈现的。

我还在控制台上看到以下内容

 Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

我都试过了,结果都一样。显示 self.view.frame 会显示一个大约 0,0,300,200 的矩形 - 所以它不会过大。

知道为什么,或者如何修复/调试吗?

【问题讨论】:

  • 尝试注释掉第二行

标签: ios uiactionsheet


【解决方案1】:

对于后代 - 答案是我的层次结构中有一个“额外的视图控制器” - 如此处所述:iOS 6: What changed that made this View Controller Hierarchy break?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多