1

UITableViewCellshowsReorderControlドキュメントから:

For the reordering control to appear, you must not only set this property but implement the UITableViewDataSource method tableView:moveRowAtIndexPath:toIndexPath:. In addition, if the data source implements tableView:canMoveRowAtIndexPath: to return NO, the reordering control does not appear in that designated row.

tableviewControllerに両方があります:

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
    NSLog(@"move from:%d to:%d", fromIndexPath.row, toIndexPath.row);
   //just for test
}

コントロールの並べ替えを含む私のセルのプロパティ:

ここに画像の説明を入力してください

それでも、並べ替えコントロールが表示されません。何が欠けていますか?

4

2 に答える 2

2

UITableView を編集モードにしましたか

[tableView setEditing:YES animated:YES];

?

ちなみに、投稿した最初のメソッドは不要です。これがデフォルトの動作です。

于 2012-06-07T15:26:56.147 に答える
2

実際にテーブルの編集モードに入る必要があると思います。ビューが表示されたらコードで試すか、それを行うボタンを作成してください。

[tableView setEditing:YES animated:YES];
于 2012-06-07T15:27:09.703 に答える