the book I'm studying to program for iPhone says I can have a mixture of both UITableViewCellEditingStyle-Insert/Delete at the same time. But I couldn't figure out how to do it.There's a UITableViewdataSource 开发者_Go百科method return type of which is UITableViewCellEditingStyle.But how do I return both style simultanously if I can return just one thing-either insert or delete.
If I'm understanding correctly, you want to update your tableview by both deleting and adding a new cell (and optionally animating that change).You need to nest your calls inside a beginUpdates block:
[tableView beginUpdates]
[tableView deleteRowsAtIndexPaths...
[tableView insertRowsAtIndexPaths...
[tableView commitUpdates]
You need to make sure that your UITableViewDataSourceDelegate methods reflect that change when commitUpdates: gets called.
UITableViewCellEditingStyle is a enum, so I don't think it can insert and delete at the same time. Here is an answer that might help you:
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return UITableViewCellEditingStyleInsert;
    }
    else
    {
        return UITableViewCellEditingStyleDelete;
    }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论