UITableView与UITableViewController [英] UITableView vs UITableViewController

查看:50
本文介绍了UITableView与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.

如果您查看文档: http://developer.apple.com/library/ios/# documentation/uikit/reference/UITableViewController_Class/Reference/Reference.html

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆