【问题标题】:Hide UIActionSheet on iPad在 iPad 上隐藏 UIActionSheet
【发布时间】:2011-02-17 07:12:34
【问题描述】:

我刚收到一封来自苹果的邮件,说我的 iPad 应用程序被拒绝了,因为我的“应用程序包含未指向显示它们的元素的弹出框元素以及一次在屏幕上可见的多个弹出框元素”。

问题是我调用了一个动作表,当我从一个视图切换到另一个视图时它仍然可见,并且一次可以调用动作表。 现在我问自己如何在视图更改或打开另一个操作表时隐藏操作表。

【问题讨论】:

  • 好的,现在我处理了当我使用 [myActionSheetdismissWithClickedButtonIndex:0 animated:NO] 切换视图时操作表隐藏的问题;但我不知道如何避免当我单击按钮调用 ActionSheet 时,ActionSheet 会多次打开
  • 我尝试使用 myActionSheet.visible。但它不会起作用。当我记录 myActionSheet.visible 时,我总是得到 null。

标签: ipad uiactionsheet


【解决方案1】:

我通过检查isVisible 解决了当您点击同一按钮时工作表多次显示的问题,如下所示:

- (IBAction) btnFoo: (id) sender
{
    if ([self.sheet isVisible]) {
        [self.sheet dismissWithClickedButtonIndex:self.sheet.cancelButtonIndex animated:YES];
        return;
    }

    [self.sheet showFromBarButtonItem:sender animated:YES];
}

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2014-09-10
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-18
    相关资源
    最近更新 更多