【问题标题】:iOS 8 - Modal in PopoveriOS 8 - Popover 中的模态
【发布时间】:2014-11-14 11:25:48
【问题描述】:

我有一个带有 TabBarController 的弹出窗口。在一个选项卡中有一个 TableViewController 与名称列表。还有一个加号按钮,它有一个模式 segue 到 AddCharacterVC 用于添加新名称。 在 iOS 7 中,我这样做:

AddCharacterViewController *acvc = (AddCharacterViewController *)segue.destinationViewController;
acvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
acvc.modalPresentationStyle = UIModalPresentationCurrentContext;// so it does not take full screen in popover

在 AddCharacterVC 中,我将内容大小设置为:

- (void)viewWillAppear:(BOOL)animated {

CGSize size = CGSizeMake(320, 480); // size of view in popover
if (IDIOM == IPAD && [self respondsToSelector:@selector(preferredContentSize)]){
    self.preferredContentSize = size;
}

而且效果很好。

但是,在 iOS 8 中,模态视图不会覆盖整个弹出框,使 TabBar 可见。用户可以点击或不点击,反正模态视图不会正常展开。

我试过了:

  • 将 acvc.modalPresentationStyle 设置为 UIModalPresentationOverCurrentContext
  • 试图将 TabBar 设置为隐藏
  • 在情节提要中检查到 TableVC 的边缘在底部栏下延伸,并且模态视图 (AddCharacterVC) 中的底部栏设置为无

都没有结果。

现在我唯一能想到的就是尝试制作 modalPresentationStyleCustom 并使用 UIPresentationController (我现在正在尝试这样做,但我以前没有这样做过)。我错过了什么吗?有没有其他方法可以做到这一点?抱歉,我还不能在这里发布图片。非常感谢!

【问题讨论】:

    标签: objective-c ipad ios8 modalviewcontroller popover


    【解决方案1】:

    好的,所以我已将 modalPresentationStile 设置为 UIModalPresentationCustom,并使用了 UIPresentationController - 我刚刚从 WWDC-14 的 LookInside 项目中复制了代码并对其进行了一些修改。 我不确定这是否是最好的解决方案,但它在我的情况下有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-01
      相关资源
      最近更新 更多