我使用willSelectRowAtIndexPath
委託方法來改變所選擇的小區的detailTextLabel
,亦即,i分配\U0001F44D
到所選擇的小區的detailTextLabel.text
並分配@""
到先前選擇的小區,則問題是,先前的小區被分配@""
但\U0001F44D
沒有出現新選擇的小區上,代碼如下:willSelectRowAtIndexPath不改變detailTextLabel
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSIndexPath *index = [NSIndexPath indexPathForRow:self.selectedCalcMethod inSection:0]; // index of previously selected cell
[self.mainTable cellForRowAtIndexPath:index][email protected]"";
[self.mainTable cellForRowAtIndexPath:indexPath].detailTextLabel.text [email protected]"\U0001F44D";
return indexPath;
}
其實最好還是重裝只有「髒」索引路徑,而不是整個表的 – kambala
@kambala嗯,你可以調用'reloadRowsAtIndexPaths:withRowAnimation:',但如果你不需要這樣做的動畫,因爲即使'reloadData'只爲可見單元重新加載數據,而其中的數據很少,另一方面,reloadRows必須重新計算表格佈局爲'reloadData'。 – matt