Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.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
Uitableview 可重用单元对许多单元重复相同的indexath_Uitableview_Ios7_Reuseidentifier - Fatal编程技术网

Uitableview 可重用单元对许多单元重复相同的indexath

Uitableview 可重用单元对许多单元重复相同的indexath,uitableview,ios7,reuseidentifier,Uitableview,Ios7,Reuseidentifier,我正在使用一个UITableView和一个自定义单元格;当我再次导航到tableView时,我会更改先前选定单元格的背景颜色,以便用户能够识别所选内容 if (!self.indexvalue<0) { [[self.CountryCodeTableView cellForRowAtIndexPath:self.indexvalue] setBackgroundColor:[UIColor blueColor]]; } 如果(!self.indexvalue在导航回上一个

我正在使用一个UITableView和一个自定义单元格;当我再次导航到tableView时,我会更改先前选定单元格的背景颜色,以便用户能够识别所选内容

 if (!self.indexvalue<0) {

    [[self.CountryCodeTableView cellForRowAtIndexPath:self.indexvalue] setBackgroundColor:[UIColor blueColor]];


}

如果(!self.indexvalue在导航回上一个视图控制器时,您可以使用以下方法来标识早期选定的单元格-
indexPathForSelectedRow

所以你可以用-

if (!self.indexvalue<0) {
    NSIndexPath *selectedRowIndexPath = [self.CountryCodeTableView indexPathForSelectedRow];
    [[self.CountryCodeTableView cellForRowAtIndexPath: selectedRowIndexPath] setBackgroundColor:[UIColor blueColor]];
}
if(!self.indexvalue)