In uitableviewcell, How to include re-order view (MoveRowAtIndexPath) under custom view cell in iOS 13

Viewed 176

we are facing an issue with UITableViewCell when using moveRowAtIndexPath in iOS 13. we can't expand a custom view to trailing of the cell when we using moveRowAtIndexPath.and we can't give the same width as per the cell.

We want yellow view until the end of trailing in ios 13. refer screenshot, please.

screenshot when running app in ios 12

click to see screen here

screenshot when running app in ios 13

click to see screen here

Below is my code : -

 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return headlines.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "LabelCell", for: indexPath)

        let headline = headlines[indexPath.row]
        cell.textLabel?.text = headline.title
        cell.detailTextLabel?.text = headline.text
        return cell
    }

    override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
        return .none
    }

    override func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
        return false
    }

    override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
    {
        let movedObject = self.headlines[sourceIndexPath.row]
        headlines.remove(at: sourceIndexPath.row)
        headlines.insert(movedObject, at: destinationIndexPath.row)
        debugPrint("\(sourceIndexPath.row) => \(destinationIndexPath.row)")
    }
}
0 Answers
Related