开发者

UITableView IndexPath.row out of scope

开发者 https://www.devze.com 2023-01-06 08:18 出处:网络
I am implementing the following tableview method: - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSInd开发者_StackOverflow中

I am implementing the following tableview method:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSInd开发者_StackOverflow中文版exPath *)indexPath

The problem is, when this gets hit, indexpath.row is showing up as out of scope. I am trying to handle the delete button for this row so I can delete the cell and delete the value out of the tableview's datasource.


What you are seeing is xCode's debugger being goofy. This happens a bunch. What I do is make a local variable like this and set my breakpoint there and the debugger will act better.

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
NSIndexPath temp = indexPath; //Set Debugger after this and you can inspect the variable.
}
0

精彩评论

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