Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put a Eureka form in a UIViewController together with another table?

I want to have something like this

class MyView: FormViewController {
    @IBOutlet weak var table: UITableView!
    // etc..
}

However i am not able to implement the cellForRowAtIndexPath or numberOfRowsInSection because they are already implemented within the Eurka library. I tried to overwrite those functions as well without success:

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    if tableView.restorationIdentifier != "myTable" {
        return tableView.numberOfRowsInSection(section)
    }
    return myDataType.count
}
like image 515
paierlep Avatar asked Dec 03 '25 15:12

paierlep


2 Answers

It appears that you don't need to. I tried the same thing, dragging a UITableViewController to the storyboard and setting its class to be my cub class of FormViewController. This seems to have caused a bunch of issues, as FormViewController does a bunch of stuff already that may not be 100% workable with a standard UITableViewController. So I removed it and used a UIViewController instead.

The UIViewController has a view property and the table view is a sub view of that. This seems to work.

In my subclass, I just created the rows and sections using the eureka syntax, and did not set up my own table view or the delegate or the data source. This allows the rows to appear properly with the tags and values that I set.

Look at the example app, a lot of the stuff is in there.

Not sure this technically answers your question, but I hope it helps.

like image 60
Andrew Kinnie Avatar answered Dec 06 '25 04:12

Andrew Kinnie


This is an old question but I came across a similar issue recently.

I would suggest using a container view and embed the FormViewController inside it.

This way you can have your table view in the parent UIViewController and access the form via the container. How to do that is explained in this answer

like image 31
Volkan Paksoy Avatar answered Dec 06 '25 05:12

Volkan Paksoy