【问题标题】:Resizing a Page View in a Container调整容器中页面视图的大小
【发布时间】:2015-12-21 00:33:22
【问题描述】:

我有一个 ViewController 和一个嵌入 PageViewController 的容器。容器正在使用 Autolayout 约束并且正在完美地调整大小。

我希望PageViewController 调整大小并填充容器。我有这段代码并将PageViewController 调整为容器的值(containerForCharts 作为ViewController 代码中的出口),但这些值在自动调整之前。

self.pageViewController.view.frame = 
   CGRectMake(
       containerForCharts.frame.origin.x, 
       containerForCharts.frame.origin.y,
       containerForCharts.frame.width,
       containerForCharts.frame.height
   )

有没有办法调整PageViewController 的大小以填充容器?

【问题讨论】:

    标签: ios xcode swift uipageviewcontroller uicontainerview


    【解决方案1】:

    我可以使用来调整大小

    override func viewWillLayoutSubviews() {
       self.pageViewController.view.frame =
       CGRectMake(containerForCharts.frame.origin.x, 
       containerForCharts.frame.origin.y, 
       containerForCharts.frame.width,containerForCharts.frame.height )
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-29
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 1970-01-01
      • 2016-05-03
      相关资源
      最近更新 更多