我想重新排序我的tableview中的行。我已經實施了這兩種方法。TableView setEditing也使行刪除
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath{
NSLog(@"Move Row At IndexPath");
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"Can Move Row At IndexPath");
if(indexPath.section == 0 || (indexPath.section == 1 && indexPath.row == 0)){
NSLog(@"Don't Move");
return NO;
}
return YES;
}
現在我只是要重新排序的細胞,不希望用戶刪除的細胞。但是,當我啓用編輯[tableView setEditing:yes animated:YES];
,那麼它也讓用戶從表視圖中刪除項目,我只想顯示錶視圖中的重新排序控制,如iphone設置 - >通知中心,然後按編輯。
有些人可以有一個想法如何做到這一點。
感謝
你不需要第3種方法來實現移動行...這些方法僅用於插入和刪除。 – NKB