【发布时间】:2015-03-04 15:18:57
【问题描述】:
我目前有一个 UIViewController,它包含一个菜单栏和容器 UIView。
在主视图加载时,容器有一个嵌入 segue,其中包含一个单独的主内容 UIViewController。
当我单击菜单栏中的按钮时,我设置了一个自定义 segue,以使用以下代码将 UITableViewController 加载到 UIView 容器中
-(void) perform {
BlockDetailViewController *src = (BlockDetailViewController *)[self sourceViewController];
UIViewController *dst = (UIViewController *)[self destinationViewController];
//Clear view of all subviews
for (UIView *view in src.viewContainer.subviews) {
[view removeFromSuperview];
}
//save destination
src.currentViewController = dst;
//set placeholderOutlet to destination
[src.viewContainer addSubview:dst.view];
}
这会将 UITableViewController 加载到 UIView 中,但是,UITableViewController 的大小似乎设置为默认窗口大小,这意味着 UITableViewController 的底部单元格隐藏在视图之外。如果您向上拖动,您可以看到它们,但当您松开弹跳时,它们会从视图中消失。
如何确保 UITableViewController 的大小与其所在的 UIView 大小相同?
谢谢
【问题讨论】:
标签: ios uitableview uiview autolayout uistoryboardsegue