2016-06-16 9 views
0

私は製作中にテーブルビューを設定せずに、これらのメソッドを使用するには、どのような方法があります編集モードでtableViewを設定せずにcanMoveRowAtIndexPathメソッドを使用する方法はありますか?

  1.  

    (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 
    
  2.  

    (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 
    

を実装するためにこれらの2つの方法を使用しましたモード?

答えて

-2

ここであなたの目標が何であるか正確にはわかりません。あなたの特定の問題に関する詳細を伝えることが役立つかもしれません。

UITableViewDataSource機能を使用するのではなく、UITableView自体でmoveRowAtIndexPath(indexPath: NSIndexPath, toIndexPath newIndexPath: NSIndexPath)メソッドを呼び出すことができます。あなたはbeginUpdates()endUpdates()の間でそうするでしょう。

tableView.beginUpdates() 
tableView.moveRowAtIndexPath(currentIndexPath, toIndexPath: newIndexPath) 
tableView.endUpdates() 
+0

私はエディットモードでテーブルビューを設定せずにこのメソッドを使用します。 – PinkeshGjr

関連する問題