你可以这样做。您需要实现 UITableViewDelegate 并在您的视图控制器中包含 UITableViewDatasource,然后您可以使用您在 TableViewController 中使用的功能。
基本上你应该做的是在界面构建器中添加一个 tableview,或者以编程方式(取决于你的选择)。如果它是通过界面构建器完成的,则将其输出到您的控制器。将 Delegate 添加到您的类中,您就可以访问 tableViewFunctions(cellForRow、numberOfItems、numberOfSections、didSelectRow 等...)。
此外,当您创建 tableview 时指定 tableview.delegate = self 和 tableview.datasource = self。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句