viewWillLayoutSubviews

viewWillLayoutSubviews

我正在使用情节提要开发一个iPad应用程序。对于我的应用程序,我通过将模式视图控制器的表示样式设置为表单来开发了模式视图。情节提要中是否提供了任何选项以减小模式视图的大小。

最佳答案

我认为更好的选择是通过编程设置自定义大小。

objective-c :

- (void)viewWillLayoutSubviews{
    [super viewWillLayoutSubviews];
    self.view.superview.bounds = CGRectMake(0, 0, <width>, <height>);
}

雨燕:
override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()
    self.view.superview?.bounds = CGRect(x: 0, y: 0, width: 300, height: 400)
}

将此代码放入模态视图控制器中

09-30 12:44