标签:
Required
Asks the data source for a cell to insert in a particular location of the table view. (required)//从数据源请求一个单元格数据插入到表视图中去
Declaration声明
SWIFT
func tableView(_ tableView: UITableView,
cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
OBJECTIVE-C
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
Parameters参数
tableView
A table-view object requesting the cell.//一个表视图对象请求单元格
indexPath索引路径
An index path locating a row in tableView.//一个索引存放着一行数据在表视图中
Return Value
An object inheriting继承 from UITableViewCell that the table view can use for the specified row. An assertion is raised if you return nil.
Discussion
The returned UITableViewCell object is frequently one that the application reuses for performance reasons. You should fetch a previously created cell object that is marked for reuse by sending a dequeueReusableCellWithIdentifier: message to tableView. Various attributes of a table cell are set automatically based on whether the cell is a separator and on information the data source provides, such as for accessory views and editing controls.
Import Statement
OBJECTIVE-C
@import UIKit;
SWIFT
import UIKit
Required
Tells the data source to return the number of rows in a given section of a table view. (required)//返回的是rows的个数
Declaration声明
SWIFT
func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int
OBJECTIVE-C
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
Parameters参数
tableView
The table-view object requesting this information.
section
An index number identifying a section in tableView.
Return Value
The number of rows in section.
Import Statement
OBJECTIVE-C
@import UIKit;
SWIFT
import UIKit
标签:
原文地址:http://www.cnblogs.com/wenios/p/4810105.html