简体   繁体   English

将视图控制器的视图添加到滚动视图

[英]Adding a view controller's view to a scroll view

I'm following Apple's PageControl example to add a TableViewController's view to a paging scroll view. 我正在遵循Apple的PageControl 示例 ,将TableViewController's视图添加到页面滚动视图。

The TableViewController 's view is 600x600. TableViewController的视图为600x600。 It isn't being resized automatically. 它不会自动调整大小。 Should I manually set the frame on the view while adding it to the scroll view? 将框架添加到滚动视图时,是否应该在视图上手动设置框架? Or is there a better way to do that using size classes. 还是有更好的方法使用大小类来做到这一点。

In the storyboard select the ContentView inside the ViewCell inside the Table View . 在情节ViewCell ,在Table View内的ViewCell内选择ContentView Click on the constraints in the storyboard and add a constraint between the trailing edge (right hand side) and the superview. 单击情节提要中的约束,然后在后缘(右侧)和超级视图之间添加约束。

在此处输入图片说明

For whatever views, images, labels, etc. you have inside the cells you should set up constraints also if you need to. 对于单元内部具有的任何视图,图像,标签等,也应根据需要设置约束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM