Я использую пользовательские cell.I хотите переместить эту ячейку (изменить положение ячеек)Как перемещать пользовательскую ячейку uitableview?
я использовал эти делегации
UITableViewDataSource, UITableViewDelegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *Cellidentifier = @"Celledit";
CellEdit *editCell =[tableView dequeueReusableCellWithIdentifier:Cellidentifier];
if (!editCell) {
editCell = [[CellEdit alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cellidentifier];
}
MItem *mItem = [mItems objectAtIndex:[indexPath row]];
---------------------------------
// set data 3 labales in the cell
---------------------------------
editCell.editdelegate = self;
return editCell;
editcell мой заказ клетка
[_tableViewEdit setEditing:YES animated:YES];
эта линия положить в - (void)viewDidLoad
я хочу, чтобы изменить его всегда
// table view change cells
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellEditingStyleNone;
}
- (BOOL) tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void) tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
NSInteger sourceRow = sourceIndexPath.row;
NSInteger destRow = destinationIndexPath.row;
id object = [minutesItems objectAtIndex:sourceRow];
[minutesItems removeObjectAtIndex:sourceRow];
[minutesItems insertObject:object atIndex:destRow];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
for (UIControl *control in cell.subviews)
{
if ([control isMemberOfClass:NSClassFromString(@"UITableViewCellReorderControl")] && [control.subviews count] > 0)
{
for (UIControl *someObj in control.subviews)
{
if ([someObj isMemberOfClass:[UIImageView class]])
{
UIImage *img = [UIImage imageNamed:@"logocoffee.png"];
((UIImageView*)someObj).frame = CGRectMake(0.0, 0.0, 43.0, 43.0);
((UIImageView*)someObj).image = img;
}
}
}
}
}
}
для перемещения тренажера ячейки не отображается значок с правой стороны управления
почему это? Это означает, что вы не можете переместить костюмы?
я поставил его в - (пустоте) viewDidLoad [_tableViewEdit setEditing: YES animated: YES]; эта строка линии Я хочу, чтобы он всегда редактировался. – Suravi
Вы также называете метод супер, как в примере: '[super setEditing: YES animated: YES]'? – Lisarien
Да, я добавляю его в viewDidLoad. как насчет метода ужина пользовательского UITableViewCell? – Suravi