1

I have my DetailViewController that I originally based on a UIViewController. The view uses Table View with static cells, but xcode then started to complain that I should use UITableViewController as a base class for the view. So I changed my view to be subclass of UITableViewController and wired everything again. There is a Date Picker in the bottom and when I start to use Autolayout to set constrains, xcode does not allow me to manage these under TVC. My setup works fine under ViewController.

Are there any limitations with Autolayout under TableViewController? I can also see that Table View always fills up whole view under TVC and does not allow uder subviews to exist on the same level.

Many thanks!

4

1 回答 1

1

只有 UITableViewController 可以使用故事板中定义的静态单元格。但是,它只能真正显示一个表视图,而不能显示其他视图 - 它的view属性是表视图,您不能只向其中添加新的子视图。

解决方案是使用表视图控制器来保存和管理表,并使其成为主控制器的子视图控制器。使用容器视图和嵌入在情节提要中实现这一点很简单。然后,表格视图是主视图控制器视图的子视图,您可以像以前一样添加其他视图,例如选择器。

于 2013-05-27T16:28:00.567 回答