How to use a button row as a button without going into a segue?
@ageorgios very good question..
This is pretty simple using on cell selection callback
ButtonRow() {
$0.title = "Button"
}
.onCellSelection { cell, row in //do whatever you want }
Regards
This should be in the examples (of the 10 button row examples, none contained this), spent ages tracking this down! it's so simple!
Maybe add a simple alert view showing this in the examples?
also, if you're using a SwitchRow you want onChange.
Thanks!
@lakhman I agree with you on this. Could you please change some of these 10 buttons to perform the segue from .onCellSelection { cell, row in //do whatever you want }?
Regards
If I remove the following line, it messes the layout up.
<<< ButtonRow("Accesory View Navigation") { (row: ButtonRow) in
row.title = row.tag
//row.presentationMode = .SegueName(segueName: "AccesoryViewControllerSegue", completionCallback: nil)
}
.onCellSelection({ (cell, row) in
self.performSegueWithIdentifier("AccesoryViewControllerSegue", sender: self)
})

This is by default, you will have to add updateCell callback to fix the layout by aligning to the left and adding the proper accessory view.
Typically when you have a handler like this you want to perform a action and not transitioning to another view controller.
I can't get this to work.
What's the difference between, cell row.cell or row.baseCell? When I try to update any of them (in the block, or cellSetup callback) it just doesn't work.
<<< ButtonRow("Accesory View Navigation") { (row: ButtonRow) in
row.title = row.tag
//row.presentationMode = .SegueName(segueName: "AccesoryViewControllerSegue", completionCallback: nil)
row.cellStyle = .Value1
row.cell.accessoryType = .DisclosureIndicator
row.updateCell()
}
.cellSetup({ (cell, row) in
cell.accessoryType = .DisclosureIndicator
})
.onCellSelection({ (cell, row) in
self.performSegueWithIdentifier("AccesoryViewControllerSegue", sender: self)
})
you should use .cellUpdate since before .cellUpdate is invoked eureka sets up the default accessoryType. .cellSetup is invoked before eureka set up the cell's accessoryType.
cell is the same as row.cell.
row.baseCell instance is the same as cell and row.cell in terms of memory ;) but sometimes eureka does not have type information, in particular when using BaseRow which only knows that it has a cell but not its type.
If you take a look into the core Eureka code, at FormViewController level Eureka works with rows and cells but on top of BaseRow BaseCell abstraction. It's not possible for the FormViewController to known in advance which is the type of the row/cell of something that can be created by the developer (Eureka user). The only abstraction it knows is that a form contains sections that contains BaseRows that has a cell (BaseCell).
you will have to add updateCell callback to fix the layout by aligning to the left and adding the proper accessory view.
Hi @mtnbarreto, I want my ButtonRow to look like a normal left-aligned row with an accessory indicator, the look I get when presentationMode is set. Can you please show me some sample code to get that appearance without setting presentationMode? Thanks.
Oh, I got it. Thanks!
Most helpful comment
@ageorgios very good question..
This is pretty simple using on cell selection callback
Regards