xmartlabs / XLForm

XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.
MIT License
5.77k stars 953 forks source link

tableView.selectRow not working #979

Closed RescueThemes closed 7 years ago

RescueThemes commented 7 years ago

I have a multisection that use row type XLFormRowDescriptorTypeSelectorPush I want to select the row and push when a new row is added to the section.

I'm overriding formRowHasBeenAdded() and then calling self.tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none) However the new row is not selected and the delegate method tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) is not called. I feel like I'm missing something simple here but can't figure it out. Appreciate the help

RescueThemes commented 7 years ago

I got it working by also calling the delegate method too. tableView?.selectRow(at: indexPath, animated: true, scrollPosition:.none) tableView?.delegate?.tableView?(tableView!, didSelectRowAt: indexPath)