UITableViewController与UIViewController [英] UITableViewController vs UIViewController
问题描述
UITableViewController
能使我真正有用吗?除了使用 UITableViews
的视图之外,还不只是使用 UIViewController
来使用它吗?我之所以这样问,是因为我希望使用 UITableViews
的视图继承自基本视图控制器(该继承自 UIViewController
).如果我使用 UITableViewController
,那么为所有视图提供基类将变得更加困难.
What all does UITableViewController
get me that makes it actually useful? Is there any bonus is using it instead of just using a UIViewController
for views with UITableViews
in them? I ask because I want my views with UITableViews
to inherit from a base view controller (which inherits from UIViewController
). If I use a UITableViewController
then having a base class for all my views becomes more difficult.
推荐答案
不多.它提供了一些便利,但是您从来没有真正需要它.我经常不使用它.
Not much. It provides some conveniences, but you never really need it; I often don't use it.
在情节提要中创建一个自动设置时,除了自动设置外,还有三个属性: tableView
, clearsSelectionOnViewWillAppear
和 refreshControl
.但是他们什么也做不了你自己做不到.
The main things, aside from the automatic setup when you create one in the storyboard, are the three properties tableView
, clearsSelectionOnViewWillAppear
, and refreshControl
. But they don't do anything you can't do yourself.
这篇关于UITableViewController与UIViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!