I'm fairly new in Swift, i'm working on a dynamic table view and use reusable cell to create the view like on the screenshots my code works just fine to remove the border line of the text field, but it doesn't work when I want it to make as a first responder as soon when it comes to this page. I want to make the first row of the second section as the first responder. How do I do this?
Here's my code :
func styling() {
for rowIndex in 0...tableView.numberOfRows(inSection: 1) {
let indexPath = IndexPath(row: rowIndex, section: 1)
if let editPriceCell = tableView.cellForRow(at: indexPath) as? priceListCell {
editPriceCell.txtFieldEditPrice.becomeFirstResponder() // does not work
editPriceCell.txtFieldEditPrice.borderStyle = .none
}
}
}
Here's what I want :
when I move into this page, I want the first row of Change Price to becomeFirstResponder
and shows up the keyboard. but it doesn't work. I have to click on the text field and then will show up the keyboard. Any solution?
Thanks for your time.