【发布时间】:2012-11-19 22:58:32
【问题描述】:
我正在尝试使用 2 类 UITableViewCell 的 UITableView(第 0 节有一行,第 1 节有 [self.dataArray count] 行)。
reordering control in UITableView
Reorder control isn't displayed on table view
我已添加:
-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
// Get the object we are going to move
Task *task = [[Task alloc] init];
task = [self.taskArray objectAtIndex:[destinationIndexPath row]];
// We will delete and move it to another location so well have to retain it
//[task retain];
// Remove it an move it to other place
[self.taskArray removeObjectAtIndex:[sourceIndexPath row]];
[self.taskArray insertObject:task atIndex:[destinationIndexPath row]];
}
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 1) {
return YES;
}
return YES;
}
我确实为每个 UITableViewCell 类添加了:
cell.showsReorderControl = YES;
但仍然没有运气,没有显示 readorderControl ......有人吗?有这么多教程,但对我不起作用,这非常紧迫和烦人。
编辑:
我更改了一点主题以包含事实,即我使用的是 UIViewController 而不是 UITableViewController。
【问题讨论】:
标签: ios objective-c uitableview