UITableView与UITableViewController [英] UITableView vs UITableViewController
问题描述
有人可以向我解释UITableViewController比UITableView的优势吗?通常,我使用控制器,但是基本表视图似乎更加灵活.
Can someone explain to me the advantages of a UITableViewController over a UITableView? Generally, I use the controller but the basic table view seems a lot more flexible.
推荐答案
我总是使用UITableView.我从不使用UITableViewController.
I always use UITableView. I never use UITableViewController.
使用UITableViewController令人困惑.除了容器控制器,每个控制器都应该做一个屏幕.
Using UITableViewController is confusing. Each controller is supposed to do one screen except container controllers.
好吧,UITableViewController是一个控制器,在大多数情况下,tableView并不是唯一的控制器.
Well, UITableViewController is a controller and most of the time, a tableView is simply not the only thing there.
UITableViewController提供了很少的新接口.都不是必需的.
UITableViewController provide very little new interface compared to UITableView. None of which is essential.
– initWithStyle:
(是吗?我在笔尖中启动了tableView,并且仍然进行了很多自定义)
获取表格视图
tableView property
(原始tableView)
配置表行为
clearsSelectionOnViewWillAppear property
(好吧,只需在ViewWillAppear上放一些代码)
刷新表格视图
refreshControl property
[重新加载tableView] ?
所以你知道,
因此,除非您希望代码看起来更整洁(并且没有更多),否则我没有理由使用UITableViewController.
So unless you want your code to look neater (and not much more), there is no reason to use UITableViewController, that I know of.
这篇关于UITableView与UITableViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!