for_2012 于 2013.03.27 13:40 提问
- UITableView从右至左滑动
-
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return UITableViewCellEditingStyleDelete; } - (void)tableView:(UITableView *)tableView commitEditingStyle(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ if(editingStyle == UITableViewCellEditingStyleDelete){ //[theSimpsons removeObjectAtIndex:indexPath.row]; NSString *time = [[arrayList objectAtIndex:indexPath.row] objectForKey:@"TIME"]; NSString *date= [[arrayList objectAtIndex:indexPath.row] objectForKey:@"DATE"]; DBManager *dbm = [[DBManager alloc] init]; [dbm initiallzeDatabase]; [dbm deleteItemAtIndexPath:time :date]; //arrayList = [dbm getParkResults]; //[parkTableView reloadData]; [arrayList removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } }
这是我应用中的部分代码,编辑部分很正常,只是删除键只有在单元中从左至右滑动时才显示。现在我有一个从左至右打开的菜单,我想让用户从右至左滑动时,删除键也会显示。
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!