5
La mia domanda è come questo: Reordering UITableView without reorder control, io uso questi metodi:Riordina UITableView e nascondere riordino controllo
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{
}
E
[self.tableView setEditing:YES];
......
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
ItemTableViewCell *cell = (ItemTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ItemTableViewCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
// ...
cell.showsReorderControl = NO;
return cell;
}
Riferimenti: reordering control in UITableView
il risultato è che il la tabella può essere riordinata, ma il controllo del riordino non si nasconde mai. Quindi mi chiedo se mi sbaglio o se qualcuno mi può aiutare? Grazie.
Posso suggerisco di provare [BVReorderTableView] (https://github.com/bvogelzang/BVReorderTableView)? Invece di hackerare le subviews delle celle di UITableView, offre una soluzione un po 'più pulita. – bvogelzang