0
我尝试了大约一小时的时间,使得能够在UITableView中重新编译单元格。如何在UITableView中重新排序单元格
我创建细胞
-(UITableViewCell *)tableView:(UITableView *)tV cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tV dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Set up the cell...
cell.textLabel.text = [array objectAtIndex:indexPath.row];
cell.showsReorderControl = YES;
return cell;
}
和我有这样的:
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
和按钮方法
- (IBAction)delete:(id)sender {
if (self.btnLeft.tag == 0) {
self.btnLeft.title = @"Zakończ";
[self.tableView setEditing:YES animated:YES];
self.btnLeft.tag = 1;
}
else if (self.btnLeft.tag == 1) {
self.btnLeft.title = @"Edytuj";
[self.tableView setEditing:NO animated:YES];
self.btnLeft.tag = 0;
}
}
但是当我点击编辑按钮i setEditing to YES
,但我可以只删除行,不重新排序。 当我有错误?我的意思是,右侧单元格一侧没有重新排序图标。
我会杀了自己 - 我有这些方法,我设置了cell.showsReorderControl = YES;对于每个单元类...但没有重排序控制器出现:/ – raistlin