注意別人嘗試這個..的accessoryTypeForRowWithIndexPath委託方法現在已經大幅貶值,如果你嘗試它,你會得到這樣的信息:
警告:由於使用傳統的單元佈局 委託執行 的tableView的:accessoryTypeForRowWithIndexPath: in。請 刪除您執行此 方法並將單元格屬性 accessoryType和/或 editingAccessoryType移至 新單元格佈局行爲。在將來的 版本中將不再調用此方法 。
相反,在你的UITableViewCell子類中實現setSelected方法。如上所述withRowAnimation方法:
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
if (selected) {
self.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
} else {
self.accessoryType = UITableViewCellAccessoryNone;
}
..then使用reloadRowsAtIndexPaths。
謝謝Ben!這很好。 – 2010-01-19 18:41:12