tableView から customCell をドラッグ アンド ドロップしようとしています。customCell の画像を取得してビューの周りにドラッグする UIImageView を使用していますが、customCell の画像を取得できないという問題があります。
CustomCellClass *customCell = [[CustomCellClass alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[CustomCellClass identifier]];
customCell.textLabel.text = "Dragging cell";
_draggedImageView.image = customCell.imageRepresentation;
しかし、これは機能しません。イメージが得られません。
私も試しました:
CustomCellClass *customCell = [tableView dequeueReusableCellWithIdentifier:[CustomCellClass identifier] forIndexPath:0];
customCell.textLabel.text = "Dragging cell";
_draggedImageView.image = customCell.imageRepresentation;
これは機能しますが、問題があります。再利用された customCell のテキストを変更しているので、tableView でも変更されます。customCell のコピーが必要なので、正しいレイアウトを作成し、そのコピーで必要なもの (この場合はセルの textLabel) を変更し、ドラッグする imageView を追加します。これは、tableView の customCell から分離されます。
これを達成する方法はありますか?
皆さん、ありがとうございました。