2012-04-02 83 views
0

UITableView中有一個編輯模式,它給予用戶對行重新排序的可能性。要重新排列行,用戶應該點擊並拖動編輯按鈕(3條紋)。有沒有可能重新排列行,當用戶觸摸行時,不僅在編輯按鈕?謝謝...iPhone:UITableView重新排序行

+0

看看這個問題 - [重新排序UITableView無需重新排序控制](http://stackoverflow.com/q/5624730/194544)。也許這會有所幫助。 – beryllium 2012-04-02 12:06:28

回答

0

你可以以編程方式重排行(並在iOS 5中,你也可以重新排序整個部分)。您只需要知道用戶想要將行/節移動到哪個位置即可。你需要分別

- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath 

- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection 

使用的方法。