开发者

Deleting custom cell in Table View

I am using a Table View Cell to draw custom cell in table view. Now the problem is that when I try to delete the cell in editing style UITableViewCellEditingStyleDelete 开发者_如何学JAVAonly the the little red -ve sign bitton appear and when I click it nothing happen.

Please help me and tell me how to delete custom cell in table view

Thanks


Gyani its not at all possible that when you click on (-) sign nothing happens.

May be your tables user interaction is disabled. Try enabling tableView.userInteractionEnabled=YES

And still it does not work then post some code.

hAPPY cODING...


did you implement the appropriate delegate methods? Specifically

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath


Did you implement this delegate method by following form?

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
   if (editingStyle == UITableViewCellEditingStyleDelete)
   {
      // remove the cell from UITableView
      [tableView deleteRowsAtIndexPaths:indexPath withRowAnimation:YES];   
      // remove the data from self array or something else.
      ... 
   } 
}


Do you have a subview in the cell that stops the user interaction? maybe located in negative x, so it is over the delete button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜