简体   繁体   English

使用UITableViewController与将UITableView放入UIViewController的优缺点

[英]Pros and cons of using UITableViewController vs putting UITableView inside UIViewController

I am designing an tab bar / navigation style app and I've added TableViews using both methods. 我正在设计一个选项卡栏/导航样式应用程序,并且使用这两种方法添加了TableViews。 Is there a preferred method and what are the pros and cons of using a UITableViewController vs putting UITableView inside UIViewController 有没有首选的方法?使用UITableViewController与将UITableView放入UIViewController的利弊是什么?

I will need navigation item bars on top, informational labels, and navigation buttons on the bottom. 我将需要在顶部的导航项目栏,信息标签和在底部的导航按钮。

Thanks in advance. 提前致谢。

UITableViewController can have static cells. UITableViewController可以具有静态单元格。 TableView in a ViewController cannot. ViewController中的TableView不能。

Your labels will scroll with the tableview if you use a TableViewController unless you implement extra code to prevent it. 如果您使用TableViewController,则标签将随tableview一起滚动,除非您实现了防止它的额外代码。 With a UITableView the labels on top would stay in place automatically when scrolling. 使用UITableView时,顶部的标签在滚动时会自动保留在原位。

Navigation Bar on top will always remain on top regardless. 无论如何,位于顶部的导航栏将始终保持在顶部。

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

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