I have a UITableViewCellAccessoryDetailDisclosureButton
on some cells in a UITableView
, and when i scroll the table, the UITableViewCellAccessoryDetailDisclosureButton
gets appeared on cells that were not suppose to display the UITableViewCellAccessoryDetailDisclosureButton
button. Can someone tell me why this is happening and how i could prevent it.
I have entered the code to add the UITableViewCellAccessoryDetailDisclosureButton
in the following code:
if (cell == nil) {
cell =开发者_如何学C [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
In the table views delegate try this:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// Replace with your Row/cell check...
if (indexPath.row % 2) {
cell.accessoryType = UITableViewCellAccessoryNone;
} else {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}
精彩评论