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