Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 何时使用不同的单元格标识符检索重用的表单元格?_Iphone_Identifier - Fatal编程技术网

Iphone 何时使用不同的单元格标识符检索重用的表单元格?

Iphone 何时使用不同的单元格标识符检索重用的表单元格?,iphone,identifier,Iphone,Identifier,我只是想知道在这个系统中使用的标识符 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 我看到一些案例,人们在uiviewtable的不同部分使用不同的标识符,一般来说,这样做的动机是什么 是否因为,例如,第0节在单元格中包含一些textfiled,而第1节仅包含没有自定义控件的纯单元格,因此我们需要使用不同的标识符来检索此场景中不同类型的

我只是想知道在这个系统中使用的标识符

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
我看到一些案例,人们在uiviewtable的不同部分使用不同的标识符,一般来说,这样做的动机是什么


是否因为,例如,第0节在单元格中包含一些textfiled,而第1节仅包含没有自定义控件的纯单元格,因此我们需要使用不同的标识符来检索此场景中不同类型的单元格?使用相同的标识符如何?

是的,您通常会使用多个标识符来区分具有不同用途的单元格。特别是如果可能显示多个不同的单元类,则可能会为每个单元类使用一个标识符

假设您有两个单元格类
MyCell1
MyCell2
,用于显示两种不同类型的数据。如果对这两种单元格类型使用相同的标识符,那么在当前行确实需要
MyCell2
时,可能会返回
MyCell1