【问题标题】:UIActionsheet in the middle of the screen屏幕中间的 UIActionsheet
【发布时间】:2011-08-13 17:06:45
【问题描述】:

我想在屏幕中间显示一个 UIActionSheet。我尝试使用以下代码

UIView *placeholderview=[[UIView alloc]initWithFrame:CGRectMake(0, 310, 320, 100)]; [self.view addSubview:placeholderview]; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" 破坏性ButtonTitle:nil otherButtonTitles:@"Open File",@"Save FIle",@"New File",@"Export Image “,零]; [actionSheet showFromRect:CGRectMake(0,0, 320, 10) inView:placeholderview animated:YES]; [动作表发布];

我得到了想要的结果,但我只能单击取消按钮和导出图像按钮的一半。我不知道我哪里出错了。请任何人帮助我。我应该怎么做才能做到这一点工作。

【问题讨论】:

  • 您所面临的具体问题是什么,请详细说明您的问题无法理解
  • 可能只有占位符视图内的部分可点击?你试过扩展它吗?
  • 我认为苹果不会对此感到满意..:(

标签: iphone uiactionsheet


【解决方案1】:

UIActionSheet 设计为从屏幕底部显示。

它提供了在这些 UI 元素可能导致阻塞的情况下从工具栏或标签栏呈现的方法。

为什么要在屏幕中间显示操作表。我不建议这样做,因为它看起来不对,而且不是控件的设计行为。

您当前使用的方法适用于 iPad - 它不应该在 iPhone 上使用,因为它会导致未定义的行为(正如您所遇到的那样)。

【讨论】:

    【解决方案2】:

    UIActionSheetshowFromRect:inView:animated: 方法只能在 iPad 上使用。它在 iPhone 上的行为是未定义的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 2019-05-07
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 1970-01-01
      相关资源
      最近更新 更多