Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make first text input become first responder and show keyboard with Eureka forms?

I am using the Eureka forms swift library here: Eureka forms

I would like to have my first row of the input form become the first responder every time the view appears. I tried adding a .cellUpdate callback which is fired everytime the view appears, and doing a cell.becomeFirstResponder() but this did not work. Could someone with experience in this library please help? Thanks.

like image 212
demig0d Avatar asked Dec 19 '22 14:12

demig0d


1 Answers

Try this

import UIKit
import Eureka

class ViewController3: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        form +++ Section("Custom cells")
            <<< TextRow("TextRow"){_ in
        }
    }

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        let row = self.form.rowByTag("TextRow") as! TextRow
        row.cell.textField.becomeFirstResponder()
    }
}

I hope this helps you

like image 107
Reinier Melian Avatar answered May 21 '23 16:05

Reinier Melian