I'd like to know how to use didSelectRowAtIndex
, more specifically I'd like to know how each row of my UITableView
calls a ViewController
specified. In my code below, in case you would like every item in the array that is in UITableView
call another ViewController
.
class ViewControllerAnalise: UIViewController, UITableViewDataSource, UITableViewDelegate {
var formulas = ["Participaçao de Capital de Terceiros", "Composiçao do Endividamento", "Imobilizaçao do Patrimonio Liquido", "Liquidez Geral", "Liquidez Corrente", "Liquidez Seca", "Giro do Ativo", "Margem Liquida", "Rentabilidade do Ativo", "Rentabilidade do PL"]
override func viewDidLoad() {
super.viewDidLoad()
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! ViewControllerCell2
cell.formula.text = formulas[indexPath.row]
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return formulas.count
}
}