overview of the TableView API
来源:互联网 发布:网络视频 编辑:程序博客网 时间:2024/05/03 03:56
1、Table View
A table view itself is an instance of the UITableView class. This class declares methods that allow you to
configure the appearance of the table view—for example, specifying the default height of rows or providing
a view used as the header for the table. Other methods give you access to the currently selected row as well
as specific rows or cells. You can call other methods of UITableView to manage selections, scroll the table
view, and insert or delete rows and sections.
UITableView inherits from UIScrollView, which defines scrolling behavior for views with content larger
than the size of the window. UITableView redefines the scrolling behavior to allow vertical scrolling only.
一个表视图本身就是UITableView类的实例。该类声明了方法来显示表视图--例如:指定行的高度或提供一个视图作为表头。其他的方法可以访问当前选中的行和特定的行或单元格。你可以调用UITableview的其他方法管理分组,滑动表视图,和插入、删除行和分组。
UITableView 继承了UIScrollView, UIScrollView 为大于窗口大小的视图定义了滑动的行为。 UITableView重新定义了滑动的行为仅允许垂直滑动。
2、Data Source and Delegate 数据源和代理
A UITableView object must have a delegate and a data source. Following the Model-View-Controller design
pattern, the data source mediates between the application’s data model (that is, its model objects) and the
table view; the delegate, on the other hand, manages the appearance and behavior of the table view. The
data source and the delegate are often (but not necessarily) the same object, and that object is frequently
a custom subclass of UITableViewController.(See “Navigating a Data Hierarchy With Table Views” (page
23) for further information.)
一个表视图对象必须有一个代理和一个数据源。依照模型-视图-控制器的设计模式,数据源介于应用的数据模型和表视图之间;另一方面,代理,管理着表视图的外观和行为。
数据源和代理经常(不是必须)是同样的对象,且那个对象经常是UITableViewController的子类
The data source adopts the UITableViewDataSource protocol and the delegate adopts the
UITableViewDelegate protocol. UITableViewDataSource has one optional method through which the
data source tells the table view how many sections it has (the default is one); it also has a required method
through which it tells the table view how many rows are in each section. The UITableViewDelegate
protocol declares a method that the delegate must implement to return a cell object that the table view uses
when drawing a particular row. (“Table View Cells” (page 22) gives more detail about this delegate task.) It
also allows the delegate to modify visible aspects of the table view. Both protocols also include optional
methods for responding to selections and taps on accessory views and for managing the insertion, deletion,
and reordering of cells.
数据源采用了表视图数据源协议,代理采用了表视图代理协议。 表视图数据源有一个可选的方法,通过这个方法,数据源告之表视图有多少分组(部分);表视图还有一个必需的方法,告之在每一个部分(分组)中有多少行 。 表视图代理协议声明了一个方法,代理必须继承返回一个单元格对象
An application can make use of a convenience class, UILocalizedIndexedCollation, to help the data
source organize the data for indexed lists and display the proper section when users tap an item in the index.
The UILocalizedIndexedCollation class also localizes section titles. The
UILocalizedIndexedCollation class was introduced in iOS 3.0.
- overview of the TableView API
- chapter 25 An Overview of the C API
- iOS-Core Bluetooth Overview(API Reference) of the second part
- Overview of the Book
- PIL--24 - An Overview of the C API C API概览
- Overview of the .NET Framework
- Overview of the Financial Accounting
- Overview of the CATIA MMLs
- 3.1. Overview of the Patterns
- Swift 学习笔记 UITableView (二)Overview of the table View API
- [转] A Brief Overview Of Vulkan API
- A Brief Overview Of Vulkan API
- 1.5. An Overview of the Unix Filesystem
- General Overview of The System(一)
- A brief overview of the Windows debuggers
- XNA: Overview of the Content Pipeline
- Overview of the Supplier Item Catalog
- Overview of the Marching Cubes Algorithm
- <S:date 的使用方法
- android 调用其它应用的Activity
- Shell脚本学习-程序调试
- 由“讨论:如何跟偶遇的美女搭讪”引起的回忆
- 团队的灵魂与鬼魂
- overview of the TableView API
- win7 计算器的用法
- Java集合框架总结
- android 虚拟机
- XNA--Object Transformation
- Linux内核的Oops问题详解
- 动态链接库的创建及使用
- C# BufferedStream 与MemoryStream 的区别
- 性能测试新手误区