Tod*_*ddB 4 iphone uitableview ios
非常非常基本.我不明白.当表加载时和canEdit调用切换时,调用但不调用canMove.我究竟做错了什么?
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"canEdit=%d", indexPath.row);
// output is as expected, "canEdit" for each row
return (indexPath.section == 1) ? YES : NO;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"canMove=%d", indexPath.row);
// nothing. No output
return (indexPath.section == 1) ? YES : NO;
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
Tod*_*ddB 13
对不起,这个问题在这里得到解答:
你还必须实施
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
Run Code Online (Sandbox Code Playgroud)
斯威夫特:
func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
//code
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5608 次 |
| 最近记录: |