【问题标题】:Change the size if a Popover when using Storyboard使用情节提要时更改弹出框的大小
【发布时间】:2018-12-01 01:21:36
【问题描述】:

我想在 Interface Builder 中将 Popover 用作 segue 时更改其大小。

我已经将我的 ViewController 的大小设置为一个明确的值,但弹出框仍然有 standard size

我会发现这个:

Popover size with UINavigationController in Storyboard

但这对我不起作用。故事板编辑器不可能做到这一点吗?否则我需要在 BarButtonItem 点击时手动调用它。

【问题讨论】:

    标签: ios swift uipopovercontroller


    【解决方案1】:

    如果您的应用在 iOS 版本 contentSizeForViewInPopover:

    // Inside your view controller
    - (CGSize)contentSizeForViewInPopover
    {
        return CGSizeMake(450, 250);
    }
    

    【讨论】:

    • 已弃用。使用preferredContentSize,或从弹出框使用setContentSize:
    • 谢谢。但我怎么能用这个?我的 UIPopoverControllerDelegate 中没有方法“contentSizeForViewInPopover”。我知道如果我手动调用它,我可以使用 setContentSize,但是有没有办法将它设置为我在 IB 中的 Popover?
    • @derdida - 您可以将此添加到弹出窗口中显示的视图控制器中。话虽如此,它已被弃用,因此其他解决方案可能更好。
    • 谢谢。我的 PopoverViewController 中的 self.preferredContentSize = CGSizeMake(450, 250) 工作正常!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-07
    • 1970-01-01
    • 2016-09-17
    • 2016-01-10
    • 2016-03-19
    • 2014-08-27
    • 2012-04-26
    相关资源
    最近更新 更多