I would like to know if there is anyway to stop the "clear" button from appearing on a specific uitableviewcell and let it appear on another?
I have set up a custome uitableview cell that has a button in it, I am using the
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
method.. I would like to know if you can stop the button that apprears on one of several uitableviewcells when the user swipes to delete?
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
return @"Clear";
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
//cell fade - notifies the user that they are edited their cell
NSArray *rowArray = [NSArray arrayWithObject:indexPath];
[self.tableView reloadRowsAtIndexPaths:rowArray withRowAnimation:UITableViewRowAnimationFade];
if (indexPath.row == 0)
{
manufactureSearchObjectString = @"empty";
[self.tableView reloadData]; //reloads the tabel with new value
manufactureResultIndexPath = nil; //removes tick from subview
}
else if (indexPath.row == 1)
{
}
else if (indexPath.row == 2)
{
}
else if (indexPath.row == 3)
{
keyTypeSearchObjectString = @"empty";
[self.tableView reloadData]; //reloads the tabel with new value
keyTypeResultIndexPath = nil; //removes tick from subview
}
}
else if (indexPath.section == 1)
{
if (indexPath == 0)
{
//can I stop the "clear" button from showing in here?
}
}
}
To be a bit more specific I am wanting to stop this from happening
USe below method
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 1)
{
if (indexPath.row == 0)
{
return NO;// you can stop the "clear" button from showing in here?
}
else
return YES;
}
else
return YES;
}