ios - 重新排序 UITableView 并隐藏重新排序控件

标签 ios uitableview

我的问题是这样的:Reordering UITableView without reorder control ,我使用这些方法:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{

}

[self.tableView setEditing:YES];

......

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    ItemTableViewCell *cell = (ItemTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ItemTableViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    // ...
    cell.showsReorderControl = NO;
    return cell;
}

引用文献:reordering control in UITableView

结果是表格可以重新排序,但重新排序控件永远不会隐藏。所以我想知道我是否错了,或者是否有人可以帮助我?谢谢。

最佳答案

检查此 URL:Reordering a UITableViewCell from any Touch point .这可能对你有帮助

关于ios - 重新排序 UITableView 并隐藏重新排序控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9529602/

相关文章:

ios - 从 YouTube JSON 数据 Objective C 获取缩略图

iphone - cellForRowAtIndexPath : not called

iphone - 如何手动删除 UITableView 中的一行?

ios - 最后两个单元格之间奇怪的 UITableViewCell 间隙

ios - 为什么删除在iOS上称为编辑,为什么应用程序需要删除?

ios - 使用 Alamofire 将 Json 发布到 API?

ios - SpriteKit 中 SKLabelNode 的物理体?

iphone - 单击上一个按钮后如何在单选按钮上保持选择

ios - 如何使用 swift 语言在 lldb 控制台中呈现/推送自定义 viewController

ios - 制作多列的tableview