1
我已經實現了此刷卡刪除,但作爲一個清除按鈕,將uitableviewcells textlabel重置爲空...當此方法執行時,它完美的工作..但是,當用戶觸摸在刷卡後,同一細胞清除沒有任何反應......那麼如果再次觸摸它,它完美的作品...這裏是我的代碼..刷卡刪除在我的UITable造成奇怪的錯誤
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
//[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
//reset uitableviewcell textlabel with default input "empty"
vehicleSearchObjectString = @"empty";
[self.tableView reloadData]; //reloads the tabels so you can see the value.
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
好的謝謝你的建議,我現在就來看看它..它是一個NSString,我已經進入了uitableview單元格..然後我將它更改回默認狀態「空」。 ..我不知道如何刪除一個NSString .. –
事情是我不想刪除該行..我只是想清除我的tableviewcell中的文本標籤 –
哦,所以你可以做的是寫: '[[[self tableView] cellForRowAtIndexPath:indexPath] textLabel] setText:@「empty」]'你不需要重新加載表格。 – Mason