Содержимое UITableViewCell исчезает - PullRequest
0 голосов
/ 14 ноября 2018

У меня есть uiTableView с 3 ячейками, в которых uiContextualAction реализован с помощью метода делегата trailingSwipeActionsConfigurationForRowAt.

При нажатии на uiContextualAction я отображаю actionSheet с двумя действиями - удалить и удалить.

Когда actionSheet отображается без нажатия какого-либо действия, содержимое ячейки для всех 3 ячеек, в частности uiImageView, внезапно исчезает.

Есть ли что-то присущее uiTableViews, вызывающее это? Я установил контрольные точки во всем вышеупомянутом потоке, но безрезультатно, как это исправить. Любые мысли будут оценены.

ДО представления actionSheet - ImageView (красный фон с голубым градиентным изображением) UITableViewCell

BEFORE presented actionSheet - ImageView (red background w/ blue gradient image) of UITableViewCell

ПОСЛЕ представленной таблицы действий - ImageView (красный фон без изображения с голубым градиентом)

AFTER on presented actionSheet - ImageView (red background w/o blue gradient image)

    func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let delete = UIContextualAction(style: .normal, title: "") { (action, view, completion) in
        self.onDeleteCell(indexPath)
        completion(true)
    }

    delete.backgroundColor = UIColor.red
    delete.image = #imageLiteral(resourceName: "x_circle")

    let config = UISwipeActionsConfiguration(actions: [delete])

    config.performsFirstActionWithFullSwipe = false

    return config
}

func onDelete(_ indexPath: IndexPath) {
     AlertController.showActionSheet(self, title: nil, message: nil, actionOneTitle: "Delete", actionOneStyle: .destructive, actionTwoTitle: "Dismiss", actionTwoStyle: .cancel) { (_) in                    
          self.updateCells(indexPath)              
     }
}


    //From custom AlertController class
    static func showActionSheet(_ inViewController: UIViewController, title: String?, message: String?, actionOneTitle: String, actionOneStyle: UIAlertAction.Style, actionTwoTitle: String, actionTwoStyle: UIAlertAction.Style, actionOneHandler: @escaping ((UIAlertAction) -> Void)) {

    let alert = UIAlertController(title: title, message: message, preferredStyle: .actionSheet)
    let actionOne = UIAlertAction(title: actionOneTitle, style: actionOneStyle, handler: actionOneHandler)
    alert.addAction(actionOne)

    let actionTwo = UIAlertAction(title: actionTwoTitle, style: actionTwoStyle, handler: nil)
    alert.addAction(actionTwo)

    inViewController.present(alert, animated: true, completion: nil)
}

1 Ответ

0 голосов
/ 15 ноября 2018

Все еще не уверены, в чем проблема / была ... но я заменил векторное изображение на png, и оно, похоже, отображается и больше не исчезает ..

Не окончательное решение, но пока оно работает для меня.

...