2012-03-02 11 views
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.

risposta

5

Controllare questo URL: Reordering a UITableViewCell from any Touch point .Questo potrebbe essere utile a voi

+1

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

Problemi correlati