1
私はRxSwiftを初めて使っています。私はUIAlertControllerが押されたときにそれを表示するために、セル内でUIButtonを取得するのに問題がありました。RxSwiftのUICollectionViewCellでUIButtonタップを購読しますか?
private func setupCellConfiguration() {
bookListViewModel.data
.bindTo(collectionView.rx.items(cellIdentifier: BookListCell.Identifier, cellType: BookListCell.self)) { [unowned self] (row, element, cell) in
cell.configureForBook(book: element)
cell.moreButton.rx.tap.subscribe { [weak self] in
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) {(action) in
self?.dismiss(animated: true, completion: nil)
}
alertController.addAction(cancelAction)
let destroyAction = UIAlertAction(title: "Delete", style: .destructive) { (action) in
}
alertController.addAction(destroyAction)
self?.present(alertController, animated: true)
}
.addDisposableTo(self.disposeBag)
}
.addDisposableTo(disposeBag)
}
押されても何も起こりません。私はここで間違って何をしていますか?
を知っているあなたは、自己がnilでなかった場合は二重チェックするためにXCodeのデバッガを使用しており、警告コントローラが正常にインスタンス化された場合は?そうすれば、どこに問題があるのかを突き止めることができます(Rxの問題なのか、それとも参照する問題なのか)。 – iwillnot